-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpyproject.toml
151 lines (138 loc) · 5.08 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
[tool.autoflake]
exclude = ["tests/autofix_files/*.py", "tests/eval_files/*.py"]
ignore-init-module-imports = true
in-place = true
quiet = true
remove-all-unused-imports = true
remove-duplicate-keys = true
remove-unused-variables = true
[tool.black]
# need to use force-exclude since pre-commit directly specifies files
force-exclude = "tests/autofix_files/.*.py"
[tool.codespell]
ignore-words-list = 'spawnve'
[tool.coverage.coverage_conditional_plugin.rules]
no-cov-has-flake8 = "is_installed('flake8')"
no-cov-no-flake8 = "not is_installed('flake8')"
no-cov-py-lt-311 = "sys.version_info < (3, 11)"
[tool.coverage.paths]
source = [
"flake8_async",
"*/site-packages/flake8_async"
]
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
# Don't check guarded type imports
"if (typing.)?TYPE_CHECKING:"
]
fail_under = 100
skip_covered = true
skip_empty = true
[tool.coverage.run]
branch = true
plugins = ["coverage_conditional_plugin"]
[tool.isort]
only_modified = true
profile = "black"
# isort is slow to release official support for new python versions
py_version = "312"
quiet = true
skip_gitignore = true
skip_glob = "tests/*_files/*"
[tool.mypy]
check_untyped_defs = true
disable_error_code = ["no-untyped-def", "misc", "no-untyped-call", "no-any-return"]
python_version = "3.9"
strict = true
warn_unreachable = true
warn_unused_ignores = false
[tool.pyright]
exclude = ["**/node_modules", "**/__pycache__", "**/.*", "tests/eval_files/*", "tests/autofix_files/*"] # TODO: fix errors in eval/autofix files
pythonVersion = "3.13"
reportCallInDefaultInitializer = true
reportImplicitStringConcatenation = false # black generates implicit string concats
reportMissingSuperCall = true
reportPropertyTypeMismatch = true
reportShadowedImports = true
reportUninitializedInstanceVariable = true
# can't enable until https://github.com/python/mypy/issues/12358
reportUnnecessaryTypeIgnoreComment = false
reportUnusedCallResult = false
strict = ["*.py", "tests/*.py", "flake8_async/**/*.py"]
[tool.pytest.ini_options]
filterwarnings = ["error"]
testpaths = ["tests"]
[tool.ruff]
extend-exclude = [
".*",
"tests/eval_files/*",
"tests/autofix_files/*"
]
line-length = 90
target-version = "py39"
[tool.ruff.lint]
ignore = [
"COM", # flake8-comma, handled by black
"ANN", # annotations, handled by pyright/mypy
"T20", # flake8-print
"TID252", # relative imports from parent modules https://github.com/python-trio/flake8-async/pull/196#discussion_r1200413372
"D101",
"D102",
"D103",
"D105",
"D106",
"D107",
"D400", # ends-in-period, stricter version of ends-in-punctuation
"S101",
"D203", # one-blank-line-before-class
"D213", # multi-line-summary-second-line
"EM101", # exception must not use a string literal
"EM102", # exception must not use an f-string literal
'S307', # No builtin `eval()` allowed
'N802', # function name should be lowercase - not an option with inheritance
'PTH123', # `open()` should be replaced by `Path.open()`
'PYI021', # docstring in stub
'S603', # `subprocess` call: check for execution of untrusted input
'N815', # Variable `visit_AsyncWith` in class scope should not be mixedCase
'PLR091', # Too many return statements/branches/arguments
'C901', # function is too complex
# maybe should be ignored in-place
'N806', # Variable `MyDict` in function should be lowercase
# --- maybe should be fixed / ignored in-place ---
'ARG001', # Unused function argument
'ARG002', # Unused method argument
'B904', # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
'B905', # zip without explicit strict parameter
'BLE001', # Do not catch blind exception: `Exception`
'FBT001', # Boolean positional arg in function definition
'FBT002', # Boolean default value in function definition
'N801', # Class name {} should use CapWords convention
'PGH003', # Use specific rule codes when ignoring type issues
'PLR2004', # Magic value used in comparison
'PLW2901', # Outer `for` loop variable `err` overwritten by inner `for` loop target
'PTH118', # `os.path.join()` should be replaced by `Path` with `/` operator
'S607', # Starting a process with a partial executable path
'SLF001', # Private member accessed: `_tree`
'TD002', # missing author in TODO
'TD003', # missing issue link in TODO
'TRY003', # Avoid specifying long messages outside the exception class
'B904', # Use `raise from` to specify exception cause
'TRY201', # Use `raise` without specifying exception name
'FIX002' # line contains #TODO
]
select = ["ALL"]
[tool.ruff.lint.per-file-ignores]
# docstrings, and arguments we can't modify
"*.pyi" = ["D", 'FBT001', 'PLR0913', "PIE790", "PYI048"]
# imports
"flake8_async/visitors/__init__.py" = [
"F401",
"E402"
]
# visitor_utility contains comments specifying how it parses noqa comments, which get
# parsed as noqa comments
"flake8_async/visitors/visitor_utility.py" = ["RUF100", "PGH004"]