-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
213 lines (199 loc) · 6.65 KB
/
pyproject.toml
File metadata and controls
213 lines (199 loc) · 6.65 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
[tool.ruff]
line-length = 88
target-version = "py310"
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"COM", # flake8-commas
"D", # pydocstyle
"E", # pycodestyle Error
"EXE", # flake8-executable
"F", # Pyflakes
"I", # isort: unsorted-imports, missing-required-import
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"RET", # flake8-return
"SIM", # flake8-simplify
"T10", # flake8-debugger
"TCH", # flake8-type-checking, not done for plugins
"TID", # flake8-tidy-imports
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle Warning
"YTT", # flake8-2020
"ARG", # flake8-unused-arguments: ARG001 Unused function argument
# "C90", # mccabe: C901: {name} is too complex ({complexity})
# "ANN", # flake8-annotationsq
# "N", # pep8-naming
# "A", # flake8-builtins
# "S", # flake8-bandit
]
ignore = [
"SIM114", # Combine `if` branches using logical `or` operator\
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"B023", # Function definition does not bind loop variable `...`
"PGH003", # Use specific rule codes when ignoring type issues
"B019", # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
"D205", # 1 blank line required between summary line and description
"D206", # Docstring should be indented with spaces, not tabs
"D211", # (Do not enable) no-blank-line-before-class
"D212", # multi-line-summary-first-line, conflicts with D213:multi-line-summary-second-line
"D401", # First line of docstring should be in imperative mood
"D417", # Missing argument descriptions in the docstring
"E402", # Module level import not at top of file
"E721", # Do not compare types, use `isinstance()`
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Use a single with statement with multiple contexts...
"UP009", # UTF-8 encoding declaration is unnecessary
"UP037", # Remove quotes from type annotation
"W191", # Indentation contains tabs
"SIM110", # Use any(...)
"SIM115", # Use context handler for opening files
# "SIM111", # Use all(...): warning: `SIM111` has been remapped to `SIM110`.
# ERA, PD,
"TCH003", # Move standard library import `...` into a type-checking block
]
# UP033: (Since Python 3.9) Use `@functools.cache`
# instead of `@functools.lru_cache(maxsize=None)`
# since which Python is comma after **kwargs allowd?
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = [
"UP010", # Unnecessary `__future__`"
"SIM108", # Use ternary operator {contents} instead of if-else-block
"C408", # Unnecessary `dict` call (rewrite as a literal)
"F401",
# "E", "F", "W",
"RET",
"I",
"COM",
"TCH",
"ANN",
"W291",
"W293",
"D",
"UP004",
"UP006",
"UP008",
"UP015",
"UP024",
"UP028",
"UP030",
"UP031",
"UP032",
"UP033",
"UP034",
"UP039",
"UP035", # Import from `collections.abc` instead: `Generator|Iterator`
# "TCH003", Move standard library import `...` into a type-checking block
]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".direnv",
".eggs",
".git",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"venv",
]
per-file-ignores = {}
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
quote-style = "double"
indent-style = "tab"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.mypy]
exclude = [
# '.*/plugin_lib/.*',
]
[tool.refurb]
ignore = [
101, # Replace `with open(x, ...) as f: y = f.read()` with `y = Path(x).read_bytes()`
103, # Replace `with open(x, ...) as f: f.write(y)` with `Path(x).write_bytes(y)`
104, # Replace `os.getcwd()` with `Path.cwd()`
107, # Replace `try: ... except OSError: pass` with `with suppress(OSError): ...`
141, # Replace `os.path.exists(x)` with `Path(x).exists()`
144, # Replace `os.remove(x)` with `Path(x).unlink()`
146, # Replace `os.path.isfile(x)` with `Path(x).is_file()`
150, # Replace `os.makedirs(x)` with `Path(x).mkdir(parents=True)`
155, # Replace `os.path.getsize(x)` with `Path(x).stat().st_size`
]
# refurb has no exclude param!
#exclude = [
# "pyglossary/plugin_lib/readmdict.py",
#]
#load = ["some_module"]
#quiet = true
[tool.pylint.messages_control]
max-line-length = 88
disable = [
"no-member",
"no-name-in-module",
"missing-module-docstring",
"bad-indentation",
"invalid-name",
"logging-fstring-interpolation",
"too-many-arguments",
"broad-exception-caught",
"missing-function-docstring",
"unused-argument",
"import-outside-toplevel",
"missing-class-docstring",
"too-many-instance-attributes",
"fixme",
"redefined-builtin",
"pointless-statement",
"abstract-method",
"unidiomatic-typecheck",
"attribute-defined-outside-init",
"unspecified-encoding",
"super-init-not-called",
"redefined-slots-in-subclass",
"redefined-outer-name",
"wrong-import-position",
"too-few-public-methods",
"too-many-lines",
"too-many-public-methods",
"too-many-statements",
"too-many-locals",
"too-many-branches",
"too-many-return-statements",
"unused-import",
"import-error",
"protected-access",
"consider-using-with",
"disallowed-name",
"useless-return",
"method-cache-max-size-none",
"global-statement",
"R0801", # Similar lines in 2 files
"ungrouped-imports", # C0412: Imports from package pyglossary are not grouped
"inconsistent-return-statements", # R1710: Either all return statements in a function should return an expression, or none of them should
"too-many-ancestors", # R0901: Too many ancestors
]
[tool.pylint.master]
ignore-paths = []