ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Added ignoring deprecated rules for --select=ALL

Open WindowGenerator opened this issue 1 year ago • 6 comments

Summary

#10342: Added ignoring deprecated rules for --select=ALL

Test Plan

Changed integration tests with --select=ALL option

WindowGenerator avatar Mar 20 '24 21:03 WindowGenerator

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+1 -35120 violations, +0 -0 fixes in 3 projects; 41 projects unchanged)

apache/airflow (+1 -24265 violations, +0 -0 fixes)

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

- airflow/api/auth/backend/kerberos_auth.py:69:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:28:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:34:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:46:20: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:53:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:60:19: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:64:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:74:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:81:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:101:19: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:112:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:133:21: ANN101 Missing type annotation for `self` in method
... 23731 additional changes omitted for rule ANN101
- airflow/callbacks/callback_requests.py:57:19: ANN102 Missing type annotation for `cls` in classmethod
- airflow/callbacks/callback_requests.py:95:19: ANN102 Missing type annotation for `cls` in classmethod
- airflow/cli/commands/standalone_command.py:51:20: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/manager.py:497:9: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/processor.py:421:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/processor.py:796:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/exceptions.py:245:15: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/base_executor.py:512:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:158:28: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:166:35: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:175:30: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:182:24: ANN102 Missing type annotation for `cls` in classmethod
... 511 additional changes omitted for rule ANN102
+ airflow/utils/pydantic.py:60:13: D107 Missing docstring in `__init__`
- airflow/utils/pydantic.py:60:13: D107 Missing docstring in `__init__`
... 24240 additional changes omitted for project
bokeh/bokeh (+0 -4088 violations, +0 -0 fixes)

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

- examples/output/apis/autoload_static.py:32:20: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:34:13: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:41:20: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:43:13: ANN101 Missing type annotation for `self` in method
- examples/server/api/tornado_embed.py:15:13: ANN101 Missing type annotation for `self` in method
- examples/server/app/server_auth/auth.py:27:13: ANN101 Missing type annotation for `self` in method
... 4003 additional changes omitted for rule ANN101
- src/bokeh/client/session.py:524:28: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:115:18: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:132:18: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:245:18: ANN102 Missing type annotation for `cls` in classmethod
... 4078 additional changes omitted for project
zulip/zulip (+0 -6767 violations, +0 -0 fixes)

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

- analytics/lib/counts.py:105:9: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:112:26: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:49:24: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:55:9: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:73:18: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:76:30: ANN101 Missing type annotation for `self` in method
... 6712 additional changes omitted for rule ANN101
- corporate/models.py:187:45: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/narrow.py:90:22: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/notes.py:40:19: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/notes.py:48:19: ANN102 Missing type annotation for `cls` in classmethod
... 6757 additional changes omitted for project
Changes by rule (3 rules affected)

code total + violation - violation + fix - fix
ANN101 34467 0 34467 0 0
ANN102 652 0 652 0 0
D107 2 1 1 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

github-actions[bot] avatar Mar 20 '24 21:03 github-actions[bot]

Is this a breaking change because we remove rules from a selector?

MichaReiser avatar Mar 20 '24 21:03 MichaReiser

@MichaReiser that's a good call... maybe. It'd be easy to hold off merging until v0.4.0 which seems reasonable.

zanieb avatar Mar 20 '24 21:03 zanieb

It might be fine, at least from our versioning policy.

The change is reasonable to me but it might be worth documenting that all selects all not deprecated rules to make it clear to users that they might "loose" rules even when upgrading to a new patch version

MichaReiser avatar Mar 20 '24 21:03 MichaReiser

hi, this changed was planned for version v0.4.0, but moved to v0.5.0

what is the reason behind this choice?

Alexdelia avatar Apr 24 '24 09:04 Alexdelia

Hey @Alexdelia, we ended up releasing the parser in 0.4.0 and focused on delivery of that. We routinely move things to later milestones when they aren't high priority for the given release.

zanieb avatar Apr 24 '24 12:04 zanieb

I tested that running ruff without preview no longer raises MissingTypeSelf when using --select ALL. ANN keeps being raised when using --select ANN.

To me this raises the question if deprecated rules should be removed from all non-exact selectors. It now feels kind of inconsistent that using ALL deselect deprecated rules but ANN doesn't

MichaReiser avatar Jun 25 '24 09:06 MichaReiser

I'll go ahead with merging this. It's heading in the right direction but we might need to figure out how we want to handle deprecation in combination with other group selectors.

MichaReiser avatar Jun 25 '24 10:06 MichaReiser