-
Notifications
You must be signed in to change notification settings - Fork 68
/
pyproject.toml
248 lines (226 loc) · 9.71 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
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
[tool.isort]
py_version = "37"
combine_as_imports = true
filter_files = true
force_grid_wrap = false
known_first_party = "ucsschool,univention"
known_third_party = "apt,apt_pkg,atexit,bzrlib,cherrypy,concurrent,Crypto,cryptography,daemon,debian,defusedxml,genshi,M2Crypto,OpenSSL,PAM,pexpect,PIL,pyasn1,PyQt4,saml2,StringIO,sqlalchemy,tornado,yattag,colorlog,commands,cups,dateutil,dns,DNS,ipaddr,lazy_object_proxy,ldap,ldb,ldif,magic,mock,netifaces,notifier,psutil,pycurl,pytest,pytz,requests,samba,six,smbpasswd,tdb,urllib3,urlparse,utils"
known_local_folder = "listener,adconnector,appcentertest,appcenteruninstalltest,dockertest,s4connector,dnstests,grep_traceback,essential,samltest,ldap_glue,ldap_glue_s4,quota_test,quota_cache,umc"
line_length = 120
multi_line_output = 5
include_trailing_comma = true
lines_after_imports = 2
skip = "doc/doc-common/,base/univention-system-setup/tests,services/univention-ldb-modules,packaging/ucslint/testframework"
skip_glob = "venv/*"
[tool.ruff]
# ruff 0.2.2
target-version = "py311"
line-length = 180
extend-exclude = [
"services/univention-ldb-modules/buildtools/",
"services/univention-ldb-modules/third_party/",
"doc/developer-reference/",
"oidc/python-keycloak",
"packaging/ucslint/testframework/",
]
[tool.ruff.lint]
preview = true
external = ["W601", "F812", "E403", "E704"]
ignore-init-module-imports = true
select = ["ALL"]
ignore = [
"E501", # ignore line length
"T20", # allow use of print()
"I", # isort, the original isort is still more acurate
"N", # ignore non PEP-8 conform names
"ANN", # missing type annotation
"ERA", # don't remove commented out code
"ARG", # ignore unused arguments
"EM", # ignore strings instead of variable preference in exception raising
"FBT", # ignore boolean trap in function arguments
"DTZ", # ignore use of datetime without explicit timezone given
"PTH", # don't use pathlib for everything
"RSE102", # we want parentheses when raising exceptions
"D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107", # ignore missing docstring
"D203", # ignore 1 blank line required before class docstring, conflicts with D211
"D212", # multiline docstring should not start at first line!
"D214", "D215", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D412", "D413", "D414", "D416", # we don't have sections
"D400", # first line should end with period
"D415", # first line should end with period, question, exclamation: maybe somewhen?!
"UP031", # allow %-interpolation
"PD011", # we don't use pandas
"INP001", # implicit namespace package
"EXE001", # Shebang is present but file is not executable
"S101", # allow to use assert (must be used in pytest)
"S105", "S106", "S107", # allow hardcoded password
"SLF001", # allow private member access
"Q000", # allow single quotes
"Q001", # allow single quote multiline strings
"Q003", # <https://docs.astral.sh/ruff/rules/avoidable-escaped-quote/>
"RET502", # allow implicit return None
"RET503", # allow missing explicit return None
"B905", # allow zip() without an explicit strict= parameter
"RUF001", # allow ambiguous-unicode-character-string
"PLR2004", # allow magic-value-comparison
"A001", "A002", "A003", # allow builtin-variable-shadowing
"B006", # allow mutable-argument-default
"B008", # allow function-call-argument-default
"B020", # allow loop-variable-overrides-iterator
"BLE001", # allow catching Exception (blind-except)
"PLR0913", # too-many-args
"PLR0915", # too-many-statements
"PLR0911", # too-many-return-statements
"PLR0912", # too-many-branches
"PLR0904", # too-many-public-methods
"PLR0917", # too-many-positional
"PLR1702", # too-many-nested-blocks
"PLR0914", # too-many-locals
"PLR6301", # no-self-use
"PLR6201", # literal-membership
"PLR1704", # redefined-argument-from-local
"PLC2801", # unnecessary-dunder-call
"PLC2701", # import-private-name
"PLW2901", # redefined-loop-name
"PLW1514", # unspecified-encoding
"PYI014", # argument-simple-defaults
"PYI034", # non-self-return-type
"PYI052", # unannotated-assignment-in-stub
"FIX001", #
"FIX002", #
"TD001",
"TD002",
"TD003",
"S301", # suspicious-pickle-usage
"S311", # suspicious-non-cryptographic-random-usage
"S602", # subprocess-popen-with-shell-equals-true
"S603", # subprocess-without-shell-equals-true
"S604", # call-with-shell-equals-true
"S607", # start-process-with-partial-path
"FURB101", # read-whole-file
"FURB105", # print-empty-string
"FURB129", # readlines-in-for
"FURB131", # delete-full-slice
"FURB132", # check-and-remove-from-set
"FURB136", # if-expr-min-max
"FURB140", # reimplemented-starmap
"FURB145", # slice-copy
"FURB148", # unnecessary-enumerate
"FURB152", # math-constant
"FURB161", # bit-count
"FURB163", # redundant-log-base
"FURB167", # regex-flag-alias
"FURB168", # isinstance-type-none
"FURB169", # type-none-comparison
"FURB171", # single-item-membership-test
"FURB177", # implicit-cwd
"FURB180", # meta-class-abc-meta
"FURB181", # hashlib-digest-hex
"S404", # suspicious-subprocess-import
"RUF021", # parenthesize-chained-operators
"PLC0415", # import-outside-top-level
# would be nice but no autofix available
"RUF012", # mutable-class-default
"S324", # hashlib-insecure-hash-function
"S113", # request-without-timeout
"S108", # hardcoded-temp-file
"S103", # bad-file-permissions
"S110", # try-except-pass
"B007", # unused-loop-control-variable
"TID252", # relative-imports
"B904", # allow raise-without-from-inside-except → too many violations
"C417", # unnecessary-map
"RET505", # superfluous-else-return
"RET506", # superfluous-else-raise
"RET507", # superfluous-else-continue
"RET508", # superfluous-else-break
"SIM115", # open-file-with-context-handler
"SIM102", # nested-if-statements
"SIM105", # use-contextlib-suppress
"TRY", # tryceratops
"PT004", "PT007", "PT011", "PT012", "PT017", "PT018", # pytest
"PGH003", # blanket-type-ignore
"UP014", # convert-named-tuple-functional-to-class
"RET504", # unnecessary-assign, https://github.com/astral-sh/ruff/issues/2263
"SIM117", # multiple-with-statements
"SIM108", # use-ternary-operator: hm, sometimes great, sometimes not
"D205", # 1 blank line required between summary line and description
"D300", # Use """triple double quotes"""
"D301", # Use r""" if any backslashes in a docstring
"D401", # First line of docstring should be in imperative mood
"D402", # First line should not be the function's signature
"D403", # First word of the first line should be properly capitalized
"D404", # First word of the docstring should not be "This"
"PLW0603", # global-statement to update identifiers
"PLR5501", # collapsible-else-if
"PYI033", # type-comment-in-stub
"PYI024", #
"PYI048", #
"TD004", #
"TD005", #
"FA100", #
"PLC1901", #
"FIX004",
"SIM112", #
"PERF203", # try-except-in-loop
"PERF401", # manual-list-comprehension
"FURB113", # repeated-append
"PT027", # pytest-unittest-raises-assertion # some still use unittest
"SIM118", # unsure if everything is a dict, let's select each individually somewhen
"SIM300", # do it somewhen
# issues in ruff:
"RUF027", # missing-f-string-syntax, https://github.com/astral-sh/ruff/issues/10023
"CPY001", # missing-copyright-notice, https://github.com/astral-sh/ruff/issues/10021
"SIM114", # https://github.com/astral-sh/ruff/issues/2848
#"PIE804", # no-unnecessary-dict-kwargs https://github.com/astral-sh/ruff/issues/2387
"RUF100", # https://github.com/astral-sh/ruff/issues/2406, https://github.com/astral-sh/ruff/issues/2407
]
unfixable = ["RUF100", "T20"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
allowed-confusables = ["’", "`", "´"]
task-tags = ["TODO", "FIXME"]
[tool.ruff.lint.extend-per-file-ignores]
"oidc/python-keycloak/keycloak/*" = [
"ALL",
]
"services/univention-ldb-modules/buildtools/*" = [
"ALL",
]
"**/tests/*" = [
"PLC0415",
]
"test/ucs-test/*" = [
"PLC0415",
]
"doc/*/conf.py" = [
"UP035",
]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["copyright", "license", "object", "exit", "quit", "credits"]
[tool.ruff.lint.mccabe]
max-complexity = 134
[tool.ruff.format]
quote-style = "single" # https://github.com/astral-sh/ruff/issues/7525
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
multiline-quotes = "double"
inline-quotes = "single"
[tool.ruff.lint.flake8-unused-arguments]
ignore-variadic-names = true
[tool.ruff.lint.flake8-pytest-style]
parametrize-names-type = "csv"
[tool.ruff.lint.flake8-annotations]
ignore-fully-untyped = true
[tool.ruff.lint.isort]
combine-as-imports = true
#filter-files = true
#force-grid-wrap = false
known-first-party = ["ucsschool", "univention"]
known-third-party = ["apt", "apt_pkg", "atexit", "bzrlib", "cherrypy", "concurrent", "Crypto", "cryptography", "daemon", "debian", "defusedxml", "genshi", "M2Crypto", "OpenSSL", "PAM", "pexpect", "PIL", "pyasn1", "PyQt4", "saml2", "StringIO", "sqlalchemy", "tornado", "unittest", "yattag", "colorlog", "commands", "cups", "dateutil", "dns", "DNS", "ipaddr", "lazy_object_proxy", "ldap", "ldb", "ldif", "magic", "mock", "netifaces", "notifier", "psutil", "pycurl", "pytest", "pytz", "requests", "samba", "six", "smbpasswd", "tdb", "urllib3", "urlparse", "utils"]
known-local-folder = ["listener", "adconnector", "appcentertest", "appcenteruninstalltest", "dockertest", "s4connector", "dnstests", "grep_traceback", "essential", "samltest", "ldap_glue", "ldap_glue_s4", "quota_test", "quota_cache", "umc"]
# https://github.com/astral-sh/ruff/issues/2600 :
#multi-line-output = 5
#include-trailing-comma = true
lines-after-imports = 2
#skip = "doc/doc-common/,base/univention-system-setup/tests,services/univention-ldb-modules,packaging/ucslint/testframework"
#skip-glob = "venv/*"