-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpyproject.toml
More file actions
234 lines (215 loc) · 7.08 KB
/
pyproject.toml
File metadata and controls
234 lines (215 loc) · 7.08 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
[tool.poetry]
name = "hyperstyle"
version = "1.7.0"
description = "A tool for running a set of pre-configured linters and evaluating code quality."
authors = ["Hyperskill Team"]
readme = "README.md"
keywords = ["code review"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Education",
]
[tool.poetry.urls]
Homepage = "https://support.hyperskill.org/hc/en-us/articles/360049582712-Code-style-Code-quality"
Repository = "https://github.com/hyperskill/hyperstyle"
[tool.poetry.scripts]
review = "hyperstyle.src.python.review.run_tool:main"
[tool.poetry.dependencies]
python = "~3.10"
setuptools = "56.0.0"
# python code analysis tools
pylint = "2.13.9"
pylint-django = "2.5.3"
flake8 = "3.9.0"
dataclasses-json="0.5.7"
# flake8 plugins
flake8-plugin-utils = "1.3.2"
flake8-bugbear = "21.4.3"
flake8-builtins = "1.5.3"
flake8-comprehensions = "3.4.0"
flake8-eradicate = "1.0.0"
flake8-import-order = "0.18.1"
flake8-polyfill = "1.0.2"
flake8-return = "1.1.2"
flake8-spellcheck = "0.24.0"
mccabe = "0.6.1"
pep8-naming = "0.11.1"
wps-light = "0.15.3"
flake8-broken-line = "0.3.0"
flake8-string-format = "0.3.0"
flake8-commas = "2.0.0"
cohesion = "1.0.0"
radon = "4.5.0"
# extra libraries and frameworks
argparse = "1.4.0"
django = "4.2.5"
requests = "2.32.3"
# grpc
grpcio-tools = "1.66.1"
protobuf = "5.27.2"
[tool.poetry.group.dev.dependencies]
jsonschema = "4.23.0"
mypy = "1.3.0"
pytest = "8.3.3"
pytest-runner = "6.0.1"
pytest-subtests = "0.13.1"
ruff = "0.6.5"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
addopts = "--strict-markers"
python_files = [
"tests.py",
"test_*.py"
]
norecursedirs = [
".git",
".idea",
"deploy",
"env",
"node_modules",
"out",
"test/resources",
"hyperstyle/src/python/review/inspectors/common/inspector/proto",
]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"arena",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"linters",
"test/resources",
"hyperstyle/src/python/review/inspectors/common/inspector/proto",
]
line-length = 110
target-version = "py310"
[tool.ruff.lint]
select = [
"ALL"
]
ignore = [
"ANN204", # Missing return type annotation for special method `__post_init__`
"ANN003", # Missing type annotation for `**kwargs`
"ANN002", # Missing type annotation for `*args`
"CPY001", # Missing copyright notice at top of file
"D101", # Missing docstring in public class
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
"FIX002", # Line contains TODO, consider resolving the issue
"S101", # Use of assert detected
"S404", # `subprocess` module is possibly insecure
"SLF001", # Private member accessed: `_get_penalty_coefficient`
"T201", # [*] `print` found
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link on the line following this TODO
# TODO: Remove the following rules after fixing the issues
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `data`
"ARG001", # Unused function argument: `name`
"ARG002", # Unused method argument: `config`
"ARG003", # Unused class method argument: `config`
"B017", # `pytest.raises(Exception)` should be considered evil
"B023", # Function definition does not bind loop variable `default_inspector`
"D100", # Missing docstring in public module
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D205", # 1 blank line required between summary line and description
"DOC201", # `return` is not documented in docstring
"DOC501", # Raised exception `InspectionError` missing from docstring
"E501", # Line too long (120 > 110)
"E741", # Ambiguous variable name: `l`
"ERA001", # Found commented-out code
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"G004", # Logging statement uses f-string
"PERF401", # Use a list comprehension to create a transformed list
"PLC2701", # Private name import `_get_format_fields` from external module `hyperstyle.src.python.review.inspectors.common.utils`
"PLR0124", # Name compared with itself, consider replacing `output_json == output_json`
"PLR2004", # Magic value used in comparison, consider replacing `15` with a constant variable
"PLR6301", # Method `__get_next_quality_type` could be a function, class method, or static method
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
"PT012", # `pytest.raises()` block should contain a single simple statement
"PTH122", # `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent`
"S103", # `os.chmod` setting a permissive mask `0o777` on file or directory
"S314", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S405", # `xml.etree` methods are vulnerable to XML attacks
"S602", # `subprocess` call with `shell=True` identified, security issue
"S603", # `subprocess` call: check for execution of untrusted input
"TRY002", # Create your own exception
# The following rules may cause conflicts when used with the formatter
"COM812",
"ISC001",
]
[tool.ruff.lint.mccabe]
max-complexity = 25
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
[tool.ruff.lint.pylint]
#max-args = 8
#max-branches = 15
#max-returns = 9
#max-statements = 32
#max-public-methods = 45
max-nested-blocks = 6
[tool.ruff.lint.isort]
combine-as-imports = true
known-third-party = []
order-by-type = false
required-imports = ["from __future__ import annotations"]
[tool.mypy]
python_version = "3.10"
check_untyped_defs = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
explicit_package_bases = true
ignore_errors = false
ignore_missing_imports = true
implicit_reexport = true
strict_equality = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
exclude = [
".git",
".idea",
"deploy",
"env",
"node_modules",
"out",
"linters",
"test/resources",
"hyperstyle/src/python/review/inspectors/common/inspector/proto",
]