Skip to content

[ruff] Implement none-not-at-end-of-union (RUF036)#14314

Merged
MichaReiser merged 3 commits intoastral-sh:mainfrom
sbrugman:none-not-at-end-of-union
Nov 14, 2024
Merged

[ruff] Implement none-not-at-end-of-union (RUF036)#14314
MichaReiser merged 3 commits intoastral-sh:mainfrom
sbrugman:none-not-at-end-of-union

Conversation

@sbrugman
Copy link
Copy Markdown
Contributor

@sbrugman sbrugman commented Nov 13, 2024

Summary

Resolves #14290.

Naming pattern inspired by https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file/.

This rule would greatly benefit from an autofix, but that's for a follow-up PR.

Test Plan

cargo test and reviewed the ecosystem results (all good).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 13, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+397 -0 violations, +0 -0 fixes in 19 projects; 35 projects unchanged)

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

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

+ tests/test_utils.py:762:25: RUF036 `None` not at the end of the type annotation.

RasaHQ/rasa (+3 -0 violations, +0 -0 fixes)

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

+ rasa/shared/core/events.py:597:48: RUF036 `None` not at the end of the type annotation.
+ rasa/shared/core/events.py:624:31: RUF036 `None` not at the end of the type annotation.
+ rasa/utils/tensorflow/models.py:247:35: RUF036 `None` not at the end of the type annotation.

apache/airflow (+122 -0 violations, +0 -0 fixes)

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

+ airflow/auth/managers/base_auth_manager.py:443:36: RUF036 `None` not at the end of the type annotation.
+ airflow/cli/commands/task_command.py:242:6: RUF036 `None` not at the end of the type annotation.
+ airflow/cli/commands/task_command.py:323:46: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:116:23: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:117:25: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:123:21: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:124:26: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:255:23: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:256:25: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:262:21: RUF036 `None` not at the end of the type annotation.
+ airflow/decorators/__init__.pyi:263:26: RUF036 `None` not at the end of the type annotation.
+ airflow/example_dags/plugins/event_listener.py:93:76: RUF036 `None` not at the end of the type annotation.
+ airflow/executors/base_executor.py:124:13: RUF036 `None` not at the end of the type annotation.
+ airflow/executors/base_executor.py:125:11: RUF036 `None` not at the end of the type annotation.
+ airflow/executors/local_executor.py:238:20: RUF036 `None` not at the end of the type annotation.
... 107 additional changes omitted for project

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

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

+ superset/config.py:1127:5: RUF036 `None` not at the end of the type annotation.
+ superset/config.py:1723:43: RUF036 `None` not at the end of the type annotation.
+ superset/config.py:714:5: RUF036 `None` not at the end of the type annotation.
+ superset/db_engine_specs/gsheets.py:166:26: RUF036 `None` not at the end of the type annotation.
+ superset/jinja_context.py:84:16: RUF036 `None` not at the end of the type annotation.

bokeh/bokeh (+3 -0 violations, +0 -0 fixes)

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

+ src/bokeh/client/websocket.py:73:85: RUF036 `None` not at the end of the type annotation.
+ src/bokeh/embed/standalone.py:84:30: RUF036 `None` not at the end of the type annotation.
+ src/bokeh/util/tornado.py:231:26: RUF036 `None` not at the end of the type annotation.

latchbio/latch (+7 -0 violations, +0 -0 fixes)

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

+ src/latch/registry/types.py:45:5: RUF036 `None` not at the end of the type annotation.
+ src/latch/types/metadata.py:419:5: RUF036 `None` not at the end of the type annotation.
+ src/latch_cli/services/get.py:38:32: RUF036 `None` not at the end of the type annotation.
+ src/latch_cli/services/launch.py:135:46: RUF036 `None` not at the end of the type annotation.
+ src/latch_cli/snakemake/config/utils.py:12:53: RUF036 `None` not at the end of the type annotation.
+ src/latch_cli/snakemake/config/utils.py:196:56: RUF036 `None` not at the end of the type annotation.
+ src/latch_sdk_gql/utils.py:38:59: RUF036 `None` not at the end of the type annotation.

lnbits/lnbits (+1 -0 violations, +0 -0 fixes)

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

+ lnbits/core/views/payment_api.py:172:27: RUF036 `None` not at the end of the type annotation.

milvus-io/pymilvus (+1 -0 violations, +0 -0 fixes)

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

+ pymilvus/client/abstract.py:799:40: RUF036 `None` not at the end of the type annotation.

pandas-dev/pandas (+59 -0 violations, +0 -0 fixes)

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

+ pandas/_libs/json.pyi:14:22: RUF036 `None` not at the end of the type annotation.
+ pandas/_libs/tslibs/timedeltas.pyi:147:36: RUF036 `None` not at the end of the type annotation.
+ pandas/_libs/tslibs/timestamps.pyi:30:41: RUF036 `None` not at the end of the type annotation.
+ pandas/core/arrays/datetimelike.py:1040:45: RUF036 `None` not at the end of the type annotation.
+ pandas/core/dtypes/cast.py:182:38: RUF036 `None` not at the end of the type annotation.
+ pandas/core/dtypes/cast.py:182:65: RUF036 `None` not at the end of the type annotation.
+ pandas/core/dtypes/dtypes.py:1271:15: RUF036 `None` not at the end of the type annotation.
+ pandas/core/generic.py:6821:15: RUF036 `None` not at the end of the type annotation.
+ pandas/core/generic.py:6823:16: RUF036 `None` not at the end of the type annotation.
+ pandas/core/generic.py:7116:15: RUF036 `None` not at the end of the type annotation.
... 49 additional changes omitted for project

pypa/cibuildwheel (+1 -0 violations, +0 -0 fixes)

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

+ cibuildwheel/options.py:719:41: RUF036 `None` not at the end of the type annotation.

python/typeshed (+146 -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/_ssl.pyi:79:58: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1726:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1736:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1746:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1756:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1765:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1774:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1783:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1793:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1805:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1814:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1823:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1832:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1840:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1848:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1856:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/ast.pyi:1865:26: RUF036 `None` not at the end of the type annotation.
+ stdlib/asyncio/base_events.pyi:27:33: RUF036 `None` not at the end of the type annotation.
... 128 additional changes omitted for project

python-poetry/poetry (+3 -0 violations, +0 -0 fixes)

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

+ src/poetry/utils/env/env_manager.py:117:35: RUF036 `None` not at the end of the type annotation.
+ src/poetry/utils/env/env_manager.py:142:13: RUF036 `None` not at the end of the type annotation.
+ src/poetry/utils/env/env_manager.py:96:44: RUF036 `None` not at the end of the type annotation.

rotki/rotki (+4 -0 violations, +0 -0 fixes)

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

+ rotkehlchen/api/rest.py:3189:55: RUF036 `None` not at the end of the type annotation.
+ rotkehlchen/chain/ethereum/modules/compound/utils.py:13:44: RUF036 `None` not at the end of the type annotation.
+ rotkehlchen/db/dbhandler.py:433:16: RUF036 `None` not at the end of the type annotation.
+ rotkehlchen/db/filtering.py:1657:34: RUF036 `None` not at the end of the type annotation.

scikit-build/scikit-build (+1 -0 violations, +0 -0 fixes)

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

+ tests/conftest.py:143:104: RUF036 `None` not at the end of the type annotation.

scikit-build/scikit-build-core (+1 -0 violations, +0 -0 fixes)

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

+ tests/test_cmake_config.py:25:26: RUF036 `None` not at the end of the type annotation.

zulip/zulip (+11 -0 violations, +0 -0 fixes)

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

+ confirmation/models.py:132:32: RUF036 `None` not at the end of the type annotation.
+ confirmation/models.py:175:32: RUF036 `None` not at the end of the type annotation.
+ zerver/lib/markdown/__init__.py:2165:59: RUF036 `None` not at the end of the type annotation.
+ zerver/lib/remote_server.py:125:49: RUF036 `None` not at the end of the type annotation.
+ zerver/lib/webhooks/common.py:158:40: RUF036 `None` not at the end of the type annotation.
+ zerver/management/commands/send_webhook_fixture_message.py:54:45: RUF036 `None` not at the end of the type annotation.
+ zerver/management/commands/send_webhook_fixture_message.py:54:60: RUF036 `None` not at the end of the type annotation.
+ zerver/tests/test_push_notifications.py:2279:61: RUF036 `None` not at the end of the type annotation.
+ zerver/tests/test_users.py:860:26: RUF036 `None` not at the end of the type annotation.
+ zerver/tornado/django_api.py:41:18: RUF036 `None` not at the end of the type annotation.
... 1 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF036 397 397 0 0 0

@MichaReiser MichaReiser added rule Implementing or modifying a lint rule preview Related to preview mode features labels Nov 14, 2024
@MichaReiser MichaReiser merged commit a40bc6a into astral-sh:main Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(🎁) new rule: in type annotations, prefer None appears at the end of unions

2 participants