forked from e-valuation/EvaP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
147 lines (118 loc) · 5.49 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
[project]
requires-python = ">=3.10"
##############################################
[tool.black]
line-length = 120
include = '(evap|tools).*\.pyi?$'
extend-exclude = """\
.*/urls\\.py|\
.*/migrations/.*\
"""
##############################################
[tool.isort]
profile = "black"
src_paths = ["evap", "tools"]
line_length = 120
skip_gitignore = true
extend_skip_glob = ["**/migrations/*"]
##############################################
[tool.ruff]
target-version = "py310"
line-length = 120
[tool.ruff.lint]
# Those are interesting, but not yet addressed: PYI,Q,SIM,PTH,TRY,RUF
select = ["F", "E", "B", "W", "N", "UP", "YTT", "FIX", "ASYNC", "A", "DJ", "EXE", "ICN", "G", "SLOT", "TID", "TCH", "INT", "C4", "ISC", "INP", "PIE", "RSE", "RET", "COM","PGH","FLY", "PERF", "PL", "BLE"]
ignore = [
"E501", # line-too-long: black does code formatting for us
"FIX004", # hacks should be possible
"A003", # we shadow some builtins sometime
"DJ008", # do not use __str__ where it is not required
"COM812", # incompatible with formatter
"N802", # not as mighty as pylint's invalid-name https://github.com/astral-sh/ruff/issues/7660
"PLR0913", # we can't determine a good limit for arguments. reviews should spot bad cases of this.
"PLR2004", "PLW2901",
]
pep8-naming.extend-ignore-names = ["assert*", "*Formset"] # custom assert methods use camelCase; Formsets use PascalCase
[tool.ruff.lint.per-file-ignores]
"**/migrations/*.py" = ["N806"] # migrations have model classes as local variables, we use PascalCase for these
"deployment/*.py" = ["INP001"] # not intended for direct import
[tool.ruff.format]
exclude = ["**/urls.py", "**/migrations/*.py"]
##############################################
[tool.pylint.master]
jobs = 0
load-plugins = ["pylint_django"]
django-settings-module = "evap.settings"
[tool.pylint.basic]
# For most code: snake_case, or PascalCaseFormset, because django does it that way.
# see https://docs.djangoproject.com/en/4.0/topics/forms/formsets/
# For migrations, models are assigned as local variables. Until pylint supports configuration-per-directory, we also
# need to allow that here (their issue 618)
variable-rgx = "(^[a-z0-9_]+$)|(^[A-Za-z]+$)"
argument-rgx = "(^[a-z0-9_]+$)|(^[A-Za-z]+$)"
method-rgx = "(^[a-z0-9_]+$)|(^assert[A-Za-z]+$)"
# Allow 4 leading digits for migrations
module-rgx = "^([0-9]{4})?([a-z_][a-z0-9_]+)$"
good-names = [ "i", "j", "k", "ex", "Run", "_", "__", "e", "logger", "setUpTestData", "setUp", "tearDown"]
[tool.pylint.format]
expected-line-ending-format = "LF"
[tool.pylint.messages_control]
enable = ["all"]
disable = [
"locally-disabled", # we allow locally disabling some checks if we think it makes sense to do that.
"suppressed-message",
"ungrouped-imports", # isort
"wrong-import-order", # isort
"too-many-public-methods", # reported for some models, that won't change
"too-few-public-methods", # noisy, e.g. exception classes, mixins etc
"no-member", # false positives, deals badly with django classes
"logging-format-interpolation", # decided against the proposed change in favor of .format()
"too-many-ancestors", # noisy, reported for all test classes
"missing-docstring", # yeah... we don't have those
"protected-access", # for us that means "be careful", not "don't do it"
"too-many-lines", # we don't currently think that splitting up views.py or test_views.py creates any value
"duplicate-code", # Mostly imports and test setup.
"cyclic-import", # We use these inside methods that require models from multiple apps. Tests will catch actual errors.
"unsupported-binary-operation", # broken in pylint: https://github.com/PyCQA/pylint/issues/7381
"use-implicit-booleaness-not-comparison-to-string", # forces us to use less expressive code
"use-implicit-booleaness-not-comparison-to-zero", # forces us to use less expressive code
# the following are covered by ruff
"broad-exception-caught", "line-too-long", "unused-wildcard-import", "wildcard-import", "too-many-arguments", "too-many-statements", "too-many-return-statements", "too-many-branches",
]
##############################################
[tool.coverage.run]
branch = true
omit = ["*migrations*", "*__init__.py"]
source = ["evap", "tools"]
[tool.coverage.report]
omit = ["*/migrations/*", "*__init__.py"]
##############################################
[tool.mypy]
packages = ["evap", "tools"]
plugins = ["mypy_django_plugin.main"]
exclude = 'evap/.*/migrations/.*\.py$'
[tool.django-stubs]
django_settings_module = "evap.settings"
[[tool.mypy.overrides]]
module = [
"django_fsm.*",
"django_sendfile.*",
"django_webtest.*",
"debug_toolbar.*",
"mozilla_django_oidc.*",
"model_bakery.*",
"webtest.*",
"xlrd.*",
"xlwt.*",
"evap.staff.fixtures.*",
]
ignore_missing_imports = true
##############################################
[tool.pytest.ini_options]
# We don't officially use pytest, but last time we wanted to, this worked for us with pytest-django
# pytest-xdist worked for parallelizing tests.
DJANGO_SETTINGS_MODULE = "evap.settings"
python_files = ["tests.py", "test_*.py", "*_tests.py"]
testpaths = ["evap", "tools"]
norecursedirs=["locale", "logs", "static", "static_collected", "upload"]
addopts = "--reuse-db"