Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ruff] Ignore empty tuples for incorrectly-parenthesized-tuple-in-subscript (RUF031) #12749

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Aug 8, 2024

Summary

It is a syntax error to replace d[()] with d[], so we skip empty tuples when checking for violations of RUF031.

Closes #12739.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MichaReiser MichaReiser merged commit f577e03 into astral-sh:main Aug 8, 2024
20 checks passed
Copy link
Contributor

github-actions bot commented Aug 8, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+259 -0 violations, +0 -0 fixes in 4 projects; 50 projects unchanged)

DisnakeDev/disnake (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ disnake/ext/commands/slash_core.py:39:11: RUF022 [*] `__all__` is not sorted

apache/superset (+108 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ superset/extensions/metadb.py:101:35: ARG002 Unused method argument: `url`
+ superset/extensions/metadb.py:102:9: D200 One-line docstring should fit on one line
+ superset/extensions/metadb.py:102:9: D212 [*] Multi-line docstring summary should start at the first line
+ superset/extensions/metadb.py:102:9: D401 First line of docstring should be in imperative mood: "A custom Shillelagh SQLAlchemy dialect with a single adapter configured."
+ superset/extensions/metadb.py:105:9: DOC201 `return` is not documented in docstring
+ superset/extensions/metadb.py:114:22: COM812 [*] Trailing comma missing
+ superset/extensions/metadb.py:126:5: D200 One-line docstring should fit on one line
+ superset/extensions/metadb.py:126:5: D212 [*] Multi-line docstring summary should start at the first line
+ superset/extensions/metadb.py:126:5: D401 First line of docstring should be in imperative mood: "Decorator that prevents DML against databases where it's not allowed."
+ superset/extensions/metadb.py:131:57: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
+ superset/extensions/metadb.py:131:72: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
+ superset/extensions/metadb.py:131:80: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `wrapper`
+ superset/extensions/metadb.py:134:19: TRY003 Avoid specifying long messages outside the exception class
+ superset/extensions/metadb.py:134:36: EM102 Exception must not use an f-string literal, assign to variable first
+ superset/extensions/metadb.py:137:5: DOC201 `return` is not documented in docstring
+ superset/extensions/metadb.py:141:5: D200 One-line docstring should fit on one line
+ superset/extensions/metadb.py:141:5: D212 [*] Multi-line docstring summary should start at the first line
+ superset/extensions/metadb.py:141:5: D401 First line of docstring should be in imperative mood: "Decorator that prevents updates/deletes on tables without a rowid."
+ superset/extensions/metadb.py:146:57: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `*args`
+ superset/extensions/metadb.py:146:72: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
... 88 additional changes omitted for project

python/typeshed (+38 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select E,F,FA,I,PYI,RUF,UP,W

+ stdlib/tkinter/__init__.pyi:197:16: PYI052 Need type annotation for `Activate`
+ stdlib/tkinter/__init__.pyi:198:19: PYI052 Need type annotation for `ButtonPress`
+ stdlib/tkinter/__init__.pyi:200:21: PYI052 Need type annotation for `ButtonRelease`
+ stdlib/tkinter/__init__.pyi:201:17: PYI052 Need type annotation for `Circulate`
+ stdlib/tkinter/__init__.pyi:202:24: PYI052 Need type annotation for `CirculateRequest`
+ stdlib/tkinter/__init__.pyi:203:21: PYI052 Need type annotation for `ClientMessage`
+ stdlib/tkinter/__init__.pyi:204:16: PYI052 Need type annotation for `Colormap`
+ stdlib/tkinter/__init__.pyi:205:17: PYI052 Need type annotation for `Configure`
+ stdlib/tkinter/__init__.pyi:206:24: PYI052 Need type annotation for `ConfigureRequest`
+ stdlib/tkinter/__init__.pyi:207:14: PYI052 Need type annotation for `Create`
... 28 additional changes omitted for project

pytest-dev/pytest (+112 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ testing/test_config.py:1005:9: PLR6301 Method `test_inifilename` could be a function, class method, or static method
+ testing/test_config.py:1089:13: PLR6301 Method `load` could be a function, class method, or static method
+ testing/test_config.py:1124:13: PLR6301 Method `load` could be a function, class method, or static method
+ testing/test_config.py:1151:13: PLR6301 Method `load` could be a function, class method, or static method
+ testing/test_config.py:1179:13: PLR6301 Method `load` could be a function, class method, or static method
+ testing/test_config.py:120:9: PLR6301 Method `test_ini_names` could be a function, class method, or static method
... 86 additional changes omitted for rule PLR6301
+ testing/test_config.py:15:28: PLC2701 Private name import `_pytest`
+ testing/test_config.py:16:28: PLC2701 Private name import `_pytest`
+ testing/test_config.py:17:28: PLC2701 Private name import `_pytest`
+ testing/test_config.py:18:28: PLC2701 Private name import `_pytest`
+ testing/test_config.py:1978:43: PLC2701 Private name import `_pytest`
+ testing/test_config.py:1978:5: PLC0415 `import` should be at the top-level of a file
+ testing/test_config.py:19:28: PLC2701 Private name import `_pytest`
... 10 additional changes omitted for rule PLC2701
+ testing/test_config.py:34:1: PLR0904 Too many public methods (23 > 20)
+ testing/test_config.py:621:9: PLC0415 `import` should be at the top-level of a file
+ testing/test_config.py:630:1: PLR0904 Too many public methods (24 > 20)
+ testing/test_config.py:919:25: PLC1901 `value == ""` can be simplified to `not value` as an empty string is falsey
+ testing/test_config.py:929:25: PLC1901 `value == ""` can be simplified to `not value` as an empty string is falsey
... 94 additional changes omitted for project

Changes by rule (36 rules affected)

code total + violation - violation + fix - fix
PLR6301 92 92 0 0 0
PYI052 38 38 0 0 0
D212 19 19 0 0 0
PLC2701 15 15 0 0 0
D200 13 13 0 0 0
ANN401 12 12 0 0 0
DOC201 9 9 0 0 0
TRY003 9 9 0 0 0
EM102 6 6 0 0 0
DOC501 4 4 0 0 0
D401 3 3 0 0 0
EM101 3 3 0 0 0
PLC0415 3 3 0 0 0
TCH002 3 3 0 0 0
ARG002 2 2 0 0 0
COM812 2 2 0 0 0
E501 2 2 0 0 0
ARG004 2 2 0 0 0
PLR2004 2 2 0 0 0
D107 2 2 0 0 0
PLR0904 2 2 0 0 0
PLC1901 2 2 0 0 0
RUF022 1 1 0 0 0
D102 1 1 0 0 0
CPY001 1 1 0 0 0
RUF012 1 1 0 0 0
FBT001 1 1 0 0 0
FBT002 1 1 0 0 0
SIM102 1 1 0 0 0
ANN204 1 1 0 0 0
E721 1 1 0 0 0
B905 1 1 0 0 0
DOC402 1 1 0 0 0
ERA001 1 1 0 0 0
TCH003 1 1 0 0 0
UP035 1 1 0 0 0

@dylwil3 dylwil3 deleted the ruf031-empty-tuple branch August 8, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checking file with rule RUF031 cause panic (probably only in debug build)
2 participants