-
Notifications
You must be signed in to change notification settings - Fork 2
/
pyproject.toml
103 lines (92 loc) · 3.18 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# ==== pytest ====
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tests.settings"
minversion = "6.0"
django_find_project = false
pythonpath = "src/"
testpaths = ["tests"]
addopts = [
"--nomigrations",
"--reuse-db",
"--ds=tests.settings"
]
norecursedirs = ["node_modules", ".tox", ".git"]
filterwarnings = [
"once::DeprecationWarning",
"once::PendingDeprecationWarning",
"ignore:Model '.*' was already registered. Reloading models is not advised.*:RuntimeWarning"
]
# ==== Coverage ====
[tool.coverage.run]
branch = true
source = ["gisserver"]
omit = ["*/migrations/*.py", "*/test*.py", "*/tests/*"]
plugins = ["django_coverage_plugin"]
# ==== black ====
[tool.black]
line-length = 99
target-version = ['py38']
# ==== ruff ====
[tool.ruff]
line-length = 99
target-version = "py38"
[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"B", # flake8-bugbear
"C90", # mccabe
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"DJ", # flake8-django
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PIE", # flake8-pie
"PGH", # pygrep-hooks
"RET", # flake8-return (partially)
# "PT", # flake8-pytest-style
# "TCH", # flake8-type-checking (moves import to `if typing.TYPE_CHECKING`)
# "ERA", # eradicate (commented out code)
# "TRY", # tryceratops
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"INT", # flake8-gettext
"FLY", # flynt (fixes unneeded static string joins)
"UP", # pyupgrade
"S", # security (bugbear)
"RUF010", # ruff: fix f"{str(..)}" usage
"RUF013", # ruff: fix annotations for =None arguments
]
ignore = [
"S311", # allow random.randint()
"DJ001", # allow models.CharField(null=True)
"SIM105", # enforcing contextlib.suppress() instead of try..catch
"RET501", # unnecessary-return-none
"RET505", # superfluous-else-return
"RET505", # superfluous-else-return
"RET506", # superfluous-else-raise
"RET507", # superfluous-else-continue
"RET508", # superfluous-else-break
"S607", # subprocess partial path
]
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.flake8-gettext]
extend-function-names = ["gettext_lazy", "ngettext_lazy", "pgettext", "pgettext_lazy", "npgettext", "npgettext_lazy"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"django.utils.timezone.make_aware".msg = "There is no need for make_aware(), pass tzinfo directly."
[tool.ruff.lint.isort]
known-first-party = ["dso_api", "rest_framework_dso", "tests"]
known-third-party = ["gisserver", "schematools"]
#required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
"**/migrations/*.py" = ["E501"] # line too long
"docs/_ext/djangodummy/settings.py" = ["S105"] # allow hardcoded SECRET_KEY
"src/tests/settings.py" = ["F405"] # allow unknown variables via import from *
"src/tests/**/*.py" = ["DJ008", "S101", "S105", "S106", "S314", "S320", "S608"] # allow asserts, hardcoded passwords, lxml parsing, SQL injection