Skip to content

Commit 9b1df13

Browse files
committed
style: added pyproject.toml to configure ruff and reformatted code
NS-11. Added a `pyproject.toml` file to define rules for Ruff linter and formatter. Then reformatted the code with `ruff check --fix`.
1 parent 2bf3918 commit 9b1df13

8 files changed

Lines changed: 53 additions & 5 deletions

File tree

api/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Create your models here.
22
from copy import deepcopy
3+
34
from django.db import models
45
from django.utils.translation import gettext_lazy as _
56

api/tests/test_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import pytest
21
import uuid
2+
3+
import pytest
34
from django.urls import reverse
45
from rest_framework.authtoken.models import Token
56

common/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import uuid
2+
23
from django.db import models
34
from django.utils.translation import gettext_lazy as _
45

common/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from copy import deepcopy
2+
13
import factory.random
24
import pytest
3-
from copy import deepcopy
45
from django.contrib.auth.models import AnonymousUser
56
from freezegun import freeze_time
67
from rest_framework.authtoken.models import Token

notification_service/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import environ
21
import os
3-
import sentry_sdk
42
import subprocess
3+
4+
import environ
5+
import sentry_sdk
56
from django.utils.translation import gettext_lazy as _
67

78
checkout_dir = environ.Path(__file__) - 2

notification_service/wsgi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
import os
11+
1112
from django.core.wsgi import get_wsgi_application
1213

1314
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "notification_service.settings")

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[tool.ruff]
2+
extend-exclude = ["migrations", "snapshots"]
3+
4+
[tool.ruff.lint]
5+
# See https://docs.astral.sh/ruff/rules/ for documentation of rules
6+
extend-select = [
7+
"B01", # Enable B01* part of flake8-bugbear (B) rules, e.g. B015 and B018
8+
"C90", # Enable mccabe (C90) rules
9+
"E", # Enable pycodestyle error (E) rules
10+
"F", # Enable Pyflakes (F) rules
11+
"I", # Enable isort (I) rules
12+
"W", # Enable pycodestyle warning (W) rules
13+
]
14+
15+
[tool.ruff.lint.isort]
16+
# isort options for ruff:
17+
# https://docs.astral.sh/ruff/settings/#lintisort
18+
order-by-type = false # Don't use type (i.e. case) to sort imports
19+
20+
[tool.ruff.format]
21+
docstring-code-format = true # Format code in docstrings
22+
23+
[tool.coverage.run]
24+
# Coverage run options:
25+
# https://coverage.readthedocs.io/en/latest/config.html#run
26+
branch = true
27+
omit = ["*migrations*", "*site-packages*", "*venv*"]
28+
29+
[tool.pytest.ini_options]
30+
# pytest-django options:
31+
# https://pytest-django.readthedocs.io/en/latest/configuring_django.html
32+
DJANGO_SETTINGS_MODULE = "notification_service.settings"
33+
34+
# pytest options:
35+
# https://docs.pytest.org/en/stable/reference/reference.html#configuration-options
36+
norecursedirs = ["node_modules", ".git", "venv*"]
37+
doctest_optionflags = [
38+
"NORMALIZE_WHITESPACE",
39+
"IGNORE_EXCEPTION_DETAIL",
40+
"ALLOW_UNICODE",
41+
]

quriiri/send.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import requests
21
import sys
2+
3+
import requests
34
from requests import ReadTimeout
45

56

0 commit comments

Comments
 (0)