forked from PyCQA/pylint-pytest
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyproject.toml
252 lines (222 loc) · 6.94 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
249
250
251
252
[build-system]
requires = ["setuptools>=66.1"]
build-backend = "setuptools.build_meta"
[project]
name = "pylint-pytest"
version = "2.0.0a0"
license = {file = "LICENSE"}
description = "A Pylint plugin to suppress pytest-related false positives."
authors = [
{name = "Reverb Chu"},
]
maintainers = [
{name = "Stavros Ntentos", email = "[email protected]"},
{name = "Pierre Sassoulas", email = "[email protected]"},
]
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Quality Assurance",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
]
keywords = [
"pylint",
"pytest",
"plugin",
]
requires-python = ">=3.8"
dependencies = [
"pylint>=2,<4",
"pytest>=4.6",
]
# [project.optional-dependencies] moved to requirements/dev.in
[project.urls]
Changelog = "https://github.com/pylint-dev/pylint-pytest/blob/master/CHANGELOG.md"
Documentation = "https://github.com/pylint-dev/pylint-pytest#readme"
Homepage = "https://github.com/pylint-dev/pylint-pytest"
Source = "https://github.com/pylint-dev/pylint-pytest"
Tracker = "https://github.com/pylint-dev/pylint-pytest/issues"
"Say Thanks!" = "https://saythanks.io/to/stdedos"
[tool.setuptools]
license-files = ["LICENSE"]
[tool.setuptools.packages.find]
exclude = [
"tests*",
"sandbox",
]
[tool.aliases]
test = "pytest"
[tool.black]
line-length = 100
[tool.coverage]
run.branch = true
run.data_file = "test_artifacts/.coverage"
xml.output = "test_artifacts/cobertura.xml"
html.directory = "test_artifacts/htmlcov"
report.exclude_lines = [
# Have to re-enable the standard pragma
'pragma: no cover',
# Don't complain about missing debug-only code:
'def __repr__',
'if self\.debug',
'if settings.DEBUG',
# Don't complain if tests don't hit defensive assertion code:
'raise AssertionError',
'raise NotImplementedError',
# Don't complain if non-runnable code isn't run:
'if 0:',
'if __name__ == .__main__.:',
# Don't complain about abstract methods, they aren't run:
'@(abc\.)?abstractmethod',
'class .*\bProtocol\):',
# Defaults must be re-listed; we cannot `extend_exclude_lines` #
# ------------------------------------------------------------ #
# Ignore type-checking blocks
'if TYPE_CHECKING:',
# Defensive programming does not need to be covered
'raise UnreachableCodeException',
]
paths.source = [
"pylint_pytest/",
]
[tool.isort]
profile = "black"
[tool.mypy]
python_version = "3.8"
check_untyped_defs = true
explicit_package_bases = true
namespace_packages = true
show_error_codes = true
strict_optional = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
exclude = [
"^.venv", # Ignore installed packages
"^.tox", # Ignore tox virtualenvs
"^.cache", # Ignore CI-defined .cache
"^tests/input/", # Ignore test inputs
"^build/", # Ignore build inputs
"^dist/", # Ignore build inputs
]
[[tool.mypy.overrides]]
module = [
"astroid",
"pylint.*",
"setuptools",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
"tests.*",
]
check_untyped_defs = true
[tool.pytest.ini_options]
addopts = "--verbose --cov-config=pyproject.toml --cov-report=html"
[tool.ruff]
fix = true
# ruff is less lenient than pylint and does not make any exceptions
# (for docstrings, strings and comments in particular).
line-length = 100
target-version = "py38"
[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
"W", # pycodestyle
"B", # bugbear
"I", # isort
"RUF", # ruff
"UP", # pyupgrade
]
ignore = [
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
[tool.ruff.lint.pydocstyle]
# https://github.com/astral-sh/ruff/pull/13286
# XXX: sphinx??
convention = "google"
[tool.ruff.lint.extend-per-file-ignores]
"tests/**/test_*.py" = [
"S101", # pytest works with `assert`s
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
# The below are debateable
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"PLR2004", # Magic value used in comparison
]
"tests/**/*_test.py" = [
"S101", # pytest works with `assert`s
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
# The below are debateable
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"PLR2004", # Magic value used in comparison
]
[tool.pylint]
py-version = "3.8"
ignore-paths="tests/input" # Ignore test inputs
load-plugins= [
"pylint_pytest",
"pylint.extensions.bad_builtin",
"pylint.extensions.broad_try_clause",
"pylint.extensions.check_elif",
"pylint.extensions.code_style",
"pylint.extensions.comparison_placement",
"pylint.extensions.confusing_elif",
# "pylint.extensions.consider_ternary_expression", # Not a pretty refactoring
"pylint.extensions.docparams",
"pylint.extensions.docstyle",
"pylint.extensions.eq_without_hash",
"pylint.extensions.for_any_all",
"pylint.extensions.mccabe",
"pylint.extensions.no_self_use",
"pylint.extensions.overlapping_exceptions",
"pylint.extensions.redefined_loop_name",
"pylint.extensions.redefined_variable_type",
"pylint.extensions.typing",
# "pylint.extensions.while_used", # highly opinionated
"pylint.extensions.dict_init_mutate",
"pylint.extensions.dunder",
# "pylint.extensions.magic_value", # highly opinionated
]
disable=[
"docstring-first-line-empty", # C0199; not-an-issue
# Temporary disables
"cannot-enumerate-pytest-fixtures", # ToDo: Our own message, fix first
"fixme", # needs-work, and probably regex
"attribute-defined-outside-init",
"confusing-consecutive-elif",
"duplicate-code",
"missing-docstring",
"redefined-loop-name",
"too-complex",
"too-many-arguments",
"too-many-nested-blocks",
"too-many-try-statements",
"unspecified-encoding",
"use-maxsplit-arg",
"used-before-assignment",
]
[tool.pylint.design]
max-args = 7
[tool.pylint.reports]
output-format = "colorized"
[tool.pylint.variables]
ignored-argument-names = "_.*"
[tool.pylint."messages control"]
enable = [
"useless-suppression",
"use-implicit-booleaness-not-comparison-to-zero",
"use-implicit-booleaness-not-comparison-to-string",
]