forked from mathiasertl/django-ca
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
248 lines (205 loc) · 6.38 KB
/
pyproject.toml
File metadata and controls
248 lines (205 loc) · 6.38 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
[build-system]
# Minimum requirements for the build system to execute (PEP-518)
# >=39.2: version added in setup.cfg
# >= 61: Add setuptools.config.setupcfg.read_configuration
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"
[django-ca.release]
# https://devguide.python.org/versions/#versions
python = ["3.8.16", "3.9.16", "3.10.10", "3.11.2"]
# https://www.djangoproject.com/download/
django = ["3.2.18", "4.1.7"]
cryptography = ["37.0.4", "38.0.4", "39.0.1"]
acme = ["2.3.0"]
josepy = ["1.13.0"]
# https://alpinelinux.org/releases/
alpine = ["3.16", "3.17"]
# Blacklist images that are just no longer built
docker-image-blacklist = [
"python:3.11-alpine3.14",
"python:3.11-alpine3.15",
]
[django-ca.validation]
# list glob-style patterns to exclude from any check
excludes = [
"ca/django_ca/migrations/0001_initial.py",
"ca/django_ca/migrations/*_auto_*.py",
]
# Files known to be stand-alone scripts (-> they include a shebang line)
standalone-scripts = [
"ca/manage.py",
"ca/django_ca/tests/fixtures/django-ca-dns-clean.py",
"ca/django_ca/tests/fixtures/django-ca-dns-auth.py",
"devscripts/standalone/validate-testdata.py",
"devscripts/standalone/test-imports.py",
"devscripts/standalone/create-testdata.py",
"devscripts/standalone/clean.py",
"devscripts/standalone/check-clean-docker.py",
]
[tool.black]
line-length = 110
extend-exclude = "(migrations|stubs)/"
[tool.coverage.report]
exclude_lines = [
"^\\s*@(abc.)?abstractmethod",
"^\\s*@(typing.)?overload",
"^\\s*if (typing.)?TYPE_CHECKING:",
"pragma: no ?cover",
]
[tool.coverage.run]
source = ["django_ca"]
branch = true
omit = [
"*/migrations/*",
"*/tests/tests*",
"*/tests/**/test_*",
]
[tool.doc8]
max-line-length = 110
ignore = [
"D000",
]
# NOTE: ideally, we would use ignore-path-errors to only ignore long lines, but doc8
# does not support directories for that.
ignore-path = [
"docs/source/generated/",
]
[tool.isort]
profile = "black"
skip_gitignore = true
line_length = 110
extend_skip = ["migrations", "stubs"]
known_crypto = [
"cryptography", "ocspbuilder", "ocspbuilder", "asn1crypto", "oscrypto",
]
known_django = "django"
known_django_addon = "django_object_actions"
known_test = ["freezegun", "selenium", "django_webtest", "pyvirtualdisplay", "requests_mock", "webtest"]
known_third_party = "OpenSSL"
known_local_folder = "django_ca"
sections = [
"FUTURE", "STDLIB", "THIRDPARTY", "CRYPTO", "DJANGO", "DJANGO_ADDON",
"TEST", "FIRSTPARTY", "LOCALFOLDER",
]
[tool.mypy]
strict = true
show_error_codes = true
mypy_path = "ca/:stubs/:docs/source/"
exclude = [
"migrations/.*\\.py$",
]
plugins = [
"mypy_django_plugin.main",
]
[[tool.mypy.overrides]]
module = [
"asn1crypto.*",
"enchant.tokenize",
"requests.packages.urllib3.response",
"sniffio",
]
ignore_missing_imports = true
[tool.django-stubs]
django_settings_module = "ca.test_settings"
[tool.pydocstyle]
convention = "numpy"
add-ignore = "D102"
match = "(?!tests?_).*\\.py"
[tool.pylint.master]
load-plugins = "pylint_django"
# Allow both snake-case and UPPER_CASE for class constants/enums
class-const-rgx = "(?:(?P<snake>[a-z_]+)|(?P<upper>[A-Z_]+))"
# Allow dashes in module names (= top level scripts)
module-rgx = "[a-z_][a-z_-]+"
# ignore migrations
ignore-paths = [
"ca/django_ca/migrations",
]
# Configure Django
init-hook = "import os, sys; sys.path.insert(0, os.path.abspath('ca'))"
django-settings-module = "ca.test_settings"
[tool.pylint.basic]
good-names = [
"ca",
"cn",
"ex",
"pk",
"e", # TODO: consistently use ex
"i",
"k",
]
[tool.pylint.design]
# Maximum number of arguments for function / method (see R0913).
max-args = 10
# Maximum number of attributes for a class (see R0902).
max-attributes = 10
# Maximum number of branch for function / method body (see R0912).
max-branches = 20
# Maximum number of parents for a class (see R0914).
max-locals = 20
# Maximum number of parents for a class (see R0901).
max-parents = 15
# Maximum number of public methods for a class (see R0904).
max-public-methods = 25
# Maximum number of return / yield for function / method body (see R0911).
max-returns = 8
# Maximum number of statements in function / method body (see R0915).
max-statements = 60
[tool.pylint.format]
max-line-length = 110
# TODO: could be reduced to 1500, only some test modulesare over that
max-module-lines = 3000
[tool.pylint.messages_control]
enable = [
"useless-suppression",
]
# https://pylint.readthedocs.io/en/latest/faq.html?highlight=flake8#i-am-using-another-popular-linter-alongside-pylint-which-messages-should-i-disable-to-avoid-duplicates
disable = [
# devscripts have some larger overlapping parts
"duplicate-code",
# These are just annoying
"too-few-public-methods",
"fixme",
# covered by isort:
"wrong-import-order",
# covered by pyflakes:
"undefined-variable", # also mypy
"unused-import",
"unused-variable",
# covered by pycodestyle:
"unneeded-not",
"line-too-long",
"unnecessary-semicolon",
"trailing-whitespace",
"missing-final-newline",
"bad-indentation",
"multiple-statements",
"bare-except",
# (seems to be) covered by mypy
"unsubscriptable-object", # mypy: index
"arguments-differ",
"no-value-for-parameter", # mypy: call-arg
"inconsistent-return-statements",
"assignment-from-no-return",
"import-error", # mypy: import
"abstract-class-instantiated", # mypy: abstract
# pylint==2.7.2 shows the error for cyclic imports in arbitrary locations, making them impossible to
# disable for specific cases. mypy requires cyclic imports for type annotiations, which are usually
# protected by TYPE_CHECKING - but pylint doesn't know that.
# https://github.com/PyCQA/pylint/issues/850
# https://github.com/PyCQA/pylint/issues/59
# https://github.com/landscapeio/landscape-issues/issues/214
"cyclic-import",
# pylint==2.9.3 does not detect methods returning a sequence as such:
# https://github.com/PyCQA/pylint/issues/4696
"unpacking-non-sequence",
]
[tool.pylint.similarities]
# Ignore comments when computing similarities.
ignore-comments = "yes"
# Ignore docstrings when computing similarities.
ignore-docstrings = "yes"
# Ignore imports when computing similarities.
ignore-imports = "yes"
# Minimum lines number of a similarity.
min-similarity-lines = 16