Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e02e7ad

Browse files
authored
Enable Ruff ANN2 (flake8-annotations, autofixes only) (#13331)
1 parent 73ce98b commit e02e7ad

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyproject.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ select = [
5050
"E", # pycodestyle Error
5151
"F", # Pyflakes
5252
"W", # pycodestyle Warning
53+
# Only include flake8-annotations rules that are autofixable. Otherwise leave this to mypy+pyright
54+
"ANN2",
5355
# Most refurb rules are in preview and can be opinionated,
5456
# consider them individually as they come out of preview (last check: 0.8.4)
5557
"FURB105", # Unnecessary empty string passed to `print`
@@ -114,11 +116,9 @@ ignore = [
114116

115117
[tool.ruff.lint.per-file-ignores]
116118
"*.pyi" = [
117-
# Ruff 0.8.0 added sorting of __all__ and __slots_.
118-
# There is no consensus on whether we want to apply this to stubs, so keeping the status quo.
119-
# See https://github.com/python/typeshed/pull/13108
120-
"RUF022",
121-
"RUF023",
119+
# A lot of stubs are incomplete on purpose, and that's configured through pyright
120+
# Some ANN204 (special method) are autofixable in stubs, but not all.
121+
"ANN2", # Missing return type annotation for ...
122122
# Most pep8-naming rules don't apply for third-party stubs like typeshed.
123123
# N811 to N814 could apply, but we often use them to disambiguate a name whilst making it look like a more common one
124124
"N8",
@@ -127,6 +127,11 @@ ignore = [
127127
# Stubs can sometimes re-export entire modules.
128128
# Issues with using a star-imported name will be caught by type-checkers.
129129
"F405", # may be undefined, or defined from star imports
130+
# Ruff 0.8.0 added sorting of __all__ and __slots_.
131+
# There is no consensus on whether we want to apply this to stubs, so keeping the status quo.
132+
# See https://github.com/python/typeshed/pull/13108
133+
"RUF022",
134+
"RUF023",
130135
]
131136
# See comment on black's force-exclude config above
132137
"*_pb2.pyi" = [

0 commit comments

Comments
 (0)