Skip to content

Comments

[ruff-0.8] Spruce up docs for newly stabilised rules#14466

Merged
AlexWaygood merged 2 commits intoruff-0.8from
alex/stabilised-docs
Nov 20, 2024
Merged

[ruff-0.8] Spruce up docs for newly stabilised rules#14466
AlexWaygood merged 2 commits intoruff-0.8from
alex/stabilised-docs

Conversation

@AlexWaygood
Copy link
Member

Summary

  • Expand some docs where they're unclear about the motivation, or assume some knowledge that hasn't been introduced yet
  • Add more links to external docs
  • Rename PYI063 from PrePep570PositionalArgument to Pep484StylePositionalOnlyParameter
  • Rename the file parenthesize_logical_operators.rs to parenthesize_chained_operators.rs, since the rule is called ParenthesizeChainedOperators, not ParenthesizeLogicalOperators

Test Plan

cargo test

@AlexWaygood AlexWaygood added the documentation Improvements or additions to documentation label Nov 19, 2024
@AlexWaygood AlexWaygood added this to the v0.8 milestone Nov 19, 2024
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 19, 2024

CodSpeed Performance Report

Merging #14466 will not alter performance

Comparing alex/stabilised-docs (bc190c8) with ruff-0.8 (f89d780)

Summary

✅ 32 untouched benchmarks

@AlexWaygood
Copy link
Member Author

Merging #14466 will degrade performances by 5.04%

Fake news! This PR only touches docs

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+364 -0 violations, +0 -0 fixes in 22 projects; 32 projects unchanged)

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

+ disnake/abc.py:205:17: RUF023 [*] `_Overwrites.__slots__` is not sorted
+ disnake/abc.py:49:11: RUF022 [*] `__all__` is not sorted
+ disnake/activity.py:13:11: RUF022 [*] `__all__` is not sorted
+ disnake/activity.py:289:17: RUF023 [*] `Activity.__slots__` is not sorted
+ disnake/activity.py:530:17: RUF023 [*] `Streaming.__slots__` is not sorted
+ disnake/activity.py:619:17: RUF023 [*] `Spotify.__slots__` is not sorted
+ disnake/activity.py:803:17: RUF023 [*] `CustomActivity.__slots__` is not sorted
+ disnake/app_commands.py:1017:17: RUF023 [*] `ApplicationCommandPermissions.__slots__` is not sorted
+ disnake/app_commands.py:1075:17: RUF023 [*] `GuildApplicationCommandPermissions.__slots__` is not sorted
+ disnake/app_commands.py:241:17: RUF023 [*] `Option.__slots__` is not sorted
... 111 additional changes omitted for rule RUF023
+ disnake/app_commands.py:49:11: RUF022 [*] `__all__` is not sorted
+ disnake/appinfo.py:23:11: RUF022 [*] `__all__` is not sorted
+ disnake/audit_logs.py:34:11: RUF022 [*] `__all__` is not sorted
+ disnake/automod.py:51:11: RUF022 [*] `__all__` is not sorted
+ disnake/channel.py:53:11: RUF022 [*] `__all__` is not sorted
+ disnake/client.py:100:11: RUF022 [*] `__all__` is not sorted
... 42 additional changes omitted for rule RUF022
+ disnake/webhook/async_.py:645:38: B039 Do not use mutable data structures for `ContextVar` defaults
... 151 additional changes omitted for project

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

+ stubs/aio_pika/__init__.pyi:23:11: RUF022 [*] `__all__` is not sorted
+ stubs/sanic.pyi:11:11: RUF022 [*] `__all__` is not sorted

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

+ src/plasmapy/particles/_special_particles.py:260:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/plasmapy/particles/decorators.py:677:9: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/plasmapy/particles/ionization_state_collection.py:479:13: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/plasmapy/plasma/grids.py:769:9: PLC0206 Extracting value from dictionary without calling `.items()`

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

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

+ airflow/__init__.py:63:11: RUF022 [*] `__all__` is not sorted
+ airflow/decorators/__init__.py:38:11: RUF022 [*] `__all__` is not sorted
+ airflow/decorators/__init__.pyi:46:11: RUF022 [*] `__all__` is not sorted
+ airflow/models/__init__.py:23:11: RUF022 [*] `__all__` is not sorted
+ airflow/providers_manager.py:104:17: RUF023 [*] `LazyDictWithCache.__slots__` is not sorted
+ airflow/secrets/__init__.py:30:11: RUF022 [*] `__all__` is not sorted
+ airflow/typing_compat.py:22:11: RUF022 [*] `__all__` is not sorted
... 9 additional changes omitted for rule RUF022
+ airflow/utils/hashlib_wrapper.py:27:9: PYI063 Use PEP 570 syntax for positional-only parameters
+ airflow/www/views.py:2228:13: PLC0206 Extracting value from dictionary without calling `.items()`
+ docs/conf.py:468:5: PLC0206 Extracting value from dictionary without calling `.items()`
... 15 additional changes omitted for project

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

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

+ RELEASING/changelog.py:227:9: PLC0206 Extracting value from dictionary without calling `.items()`
+ superset/examples/data_loading.py:36:11: RUF022 [*] `__all__` is not sorted
+ superset/jinja_context.py:483:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ superset/utils/pandas_postprocessing/__init__.py:43:11: RUF022 [*] `__all__` is not sorted
+ superset/views/__init__.py:30:11: RUF022 [*] `__all__` is not sorted
+ tests/integration_tests/reports/api_tests.py:303:9: PLC0206 Extracting value from dictionary without calling `.items()`

aws/aws-sam-cli (+1 -0 violations, +0 -0 fixes)

+ tests/integration/pipeline/test_bootstrap_command.py:229:9: PLC0206 Extracting value from dictionary without calling `.items()`

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

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

+ release/checks.py:24:11: RUF022 [*] `__all__` is not sorted
+ src/bokeh/application/handlers/code.py:201:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/bokeh/client/__init__.py:46:11: RUF022 [*] `__all__` is not sorted
+ src/bokeh/client/states.py:40:11: RUF022 [*] `__all__` is not sorted
+ src/bokeh/colors/__init__.py:37:11: RUF022 [*] `__all__` is not sorted
+ src/bokeh/core/enums.py:91:11: RUF022 [*] `__all__` is not sorted
+ src/bokeh/core/has_props.py:81:11: RUF022 [*] `__all__` is not sorted
... 48 additional changes omitted for rule RUF022
+ src/bokeh/core/property/wrappers.py:470:9: PLC0206 Extracting value from dictionary without calling `.items()`
... 47 additional changes omitted for project

ibis-project/ibis (+39 -0 violations, +0 -0 fixes)

+ ibis/backends/impala/udf.py:24:11: RUF022 [*] `__all__` is not sorted
+ ibis/backends/sql/compilers/__init__.py:3:11: RUF022 [*] `__all__` is not sorted
+ ibis/backends/sql/compilers/base.py:178:17: RUF023 [*] `FuncGen.__slots__` is not sorted
+ ibis/backends/sql/compilers/base.py:83:21: RUF023 [*] `_Accessor.__slots__` is not sorted
+ ibis/common/annotations.py:105:17: RUF023 [*] `Annotation.__slots__` is not sorted
+ ibis/common/annotations.py:207:17: RUF023 [*] `Argument.__slots__` is not sorted
+ ibis/common/annotations.py:42:17: RUF023 [*] `AttributeValidationError.__slots__` is not sorted
+ ibis/common/annotations.py:54:17: RUF023 [*] `ReturnValidationError.__slots__` is not sorted
... 32 additional changes omitted for rule RUF023
... 31 additional changes omitted for project

langchain-ai/langchain (+1 -0 violations, +0 -0 fixes)

+ libs/core/langchain_core/runnables/config.py:114:38: B039 Do not use mutable data structures for `ContextVar` defaults

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

+ src/latch/functions/operators.py:183:9: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/latch/functions/operators.py:37:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/latch/functions/operators.py:48:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/latch/functions/operators.py:59:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/latch/functions/operators.py:68:5: PLC0206 Extracting value from dictionary without calling `.items()`
+ src/latch/functions/operators.py:73:5: PLC0206 Extracting value from dictionary without calling `.items()`

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

+ lnbits/lnurl.py:59:11: RUF022 [*] `__all__` is not sorted
+ lnbits/requestvars.py:5:31: B039 Do not use mutable data structures for `ContextVar` defaults
+ lnbits/wallets/__init__.py:56:11: RUF022 [*] `__all__` is not sorted

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

+ pymilvus/__init__.py:74:11: RUF022 [*] `__all__` is not sorted
+ pymilvus/bulk_writer/buffer.py:96:9: PLC0206 Extracting value from dictionary without calling `.items()`

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

+ pandas/_typing.py:276:20: PYI063 Use PEP 570 syntax for positional-only parameters
+ pandas/_typing.py:291:20: PYI063 Use PEP 570 syntax for positional-only parameters
+ pandas/_typing.py:297:21: PYI063 Use PEP 570 syntax for positional-only parameters
+ pandas/io/stata.py:2209:5: PLC0206 Extracting value from dictionary without calling `.items()`

pypa/build (+3 -0 violations, +0 -0 fixes)

+ src/build/__init__.py:23:11: RUF022 [*] `__all__` is not sorted
+ src/build/_ctx.py:91:11: RUF022 [*] `__all__` is not sorted
+ src/build/env.py:369:11: RUF022 [*] `__all__` is not sorted

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

+ cibuildwheel/_compat/typing.py:10:11: RUF022 [*] `__all__` is not sorted
+ cibuildwheel/typing.py:8:11: RUF022 [*] `__all__` is not sorted

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

+ skbuild/__init__.py:16:11: RUF022 [*] `__all__` is not sorted
+ skbuild/_compat/typing.py:10:11: RUF022 [*] `__all__` is not sorted
+ tests/samples/issue-707-nested-packages/hello_nested/__init__.py:6:11: RUF022 [*] `__all__` is not sorted

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

+ src/scikit_build_core/_compat/importlib/metadata.py:24:11: RUF022 [*] `__all__` is not sorted
+ src/scikit_build_core/_logging.py:25:11: RUF022 [*] `__all__` is not sorted
+ src/scikit_build_core/ast/ast.py:14:11: RUF022 [*] `__all__` is not sorted
+ src/scikit_build_core/ast/ast.py:23:17: RUF023 [*] `Node.__slots__` is not sorted
+ src/scikit_build_core/ast/tokenizer.py:48:17: RUF023 [*] `Token.__slots__` is not sorted
+ src/scikit_build_core/build/__init__.py:112:16: RUF022 [*] `__all__` is not sorted

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

Changes by rule (5 rules affected)

code total + violation - violation + fix - fix
RUF023 167 167 0 0 0
RUF022 145 145 0 0 0
PLC0206 43 43 0 0 0
PYI063 5 5 0 0 0
B039 4 4 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+36 -36 violations, +0 -0 fixes in 6 projects; 48 projects unchanged)

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

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

- airflow/utils/hashlib_wrapper.py:27:9: PYI063 Use PEP 570 syntax for positional-only arguments
+ airflow/utils/hashlib_wrapper.py:27:9: PYI063 Use PEP 570 syntax for positional-only parameters
+ providers/src/airflow/providers/cloudant/hooks/cloudant.py:25:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- providers/src/airflow/providers/cloudant/hooks/cloudant.py:25:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ providers/tests/cloudant/hooks/test_cloudant.py:30:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- providers/tests/cloudant/hooks/test_cloudant.py:30:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ providers/tests/google/cloud/utils/test_mlengine_prediction_summary.py:27:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- providers/tests/google/cloud/utils/test_mlengine_prediction_summary.py:27:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
... 3 additional changes omitted for rule PYI066

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

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

- pandas/_typing.py:276:20: PYI063 Use PEP 570 syntax for positional-only arguments
+ pandas/_typing.py:276:20: PYI063 Use PEP 570 syntax for positional-only parameters
- pandas/_typing.py:291:20: PYI063 Use PEP 570 syntax for positional-only arguments
+ pandas/_typing.py:291:20: PYI063 Use PEP 570 syntax for positional-only parameters
- pandas/_typing.py:297:21: PYI063 Use PEP 570 syntax for positional-only arguments
+ pandas/_typing.py:297:21: PYI063 Use PEP 570 syntax for positional-only parameters

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

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

+ bin/bump_version.py:20:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- bin/bump_version.py:20:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ cibuildwheel/_compat/typing.py:5:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- cibuildwheel/_compat/typing.py:5:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons

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

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

+ setuptools/_importlib.py:3:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- setuptools/_importlib.py:3:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons

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

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

+ docs/conf.py:16:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- docs/conf.py:16:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/builtins.py:5:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/builtins.py:5:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/importlib/metadata.py:15:8: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/importlib/metadata.py:15:8: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/importlib/metadata.py:17:10: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/importlib/metadata.py:17:10: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/importlib/metadata.py:6:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/importlib/metadata.py:6:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/importlib/resources.py:5:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/importlib/resources.py:5:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/tomllib.py:5:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/tomllib.py:5:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/typing.py:14:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/typing.py:14:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/typing.py:19:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/typing.py:19:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_compat/typing.py:6:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_compat/typing.py:6:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/_logging.py:80:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/_logging.py:80:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/builder/sysconfig.py:179:8: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/builder/sysconfig.py:179:8: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/scikit_build_core/file_api/reply.py:76:24: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/scikit_build_core/file_api/reply.py:76:24: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
... 12 additional changes omitted for project

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

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

+ src/_pytest/_code/code.py:699:16: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/_pytest/_code/code.py:699:16: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/_pytest/assertion/rewrite.py:299:16: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/_pytest/assertion/rewrite.py:299:16: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
+ src/_pytest/pathlib.py:41:4: PYI066 Put branches for newer Python versions first when branching on `sys.version_info` comparisons
- src/_pytest/pathlib.py:41:4: PYI066 Use `>=` when using `if`-`else` with `sys.version_info` comparisons
... 5 additional changes omitted for rule PYI066
- testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py:13:26: PYI063 Use PEP 570 syntax for positional-only arguments
+ testing/example_scripts/dataclasses/test_compare_dataclasses_with_custom_eq.py:13:26: PYI063 Use PEP 570 syntax for positional-only parameters
... 4 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PYI066 62 31 31 0 0
PYI063 10 5 5 0 0

@AlexWaygood AlexWaygood merged commit 4f95abf into ruff-0.8 Nov 20, 2024
@AlexWaygood AlexWaygood deleted the alex/stabilised-docs branch November 20, 2024 08:00
MichaReiser pushed a commit that referenced this pull request Nov 20, 2024
## Summary

- Expand some docs where they're unclear about the motivation, or assume
some knowledge that hasn't been introduced yet
- Add more links to external docs
- Rename PYI063 from `PrePep570PositionalArgument` to
`Pep484StylePositionalOnlyParameter`
- Rename the file `parenthesize_logical_operators.rs` to
`parenthesize_chained_operators.rs`, since the rule is called
`ParenthesizeChainedOperators`, not `ParenthesizeLogicalOperators`

## Test Plan

`cargo test`
MichaReiser pushed a commit that referenced this pull request Nov 20, 2024
## Summary

- Expand some docs where they're unclear about the motivation, or assume
some knowledge that hasn't been introduced yet
- Add more links to external docs
- Rename PYI063 from `PrePep570PositionalArgument` to
`Pep484StylePositionalOnlyParameter`
- Rename the file `parenthesize_logical_operators.rs` to
`parenthesize_chained_operators.rs`, since the rule is called
`ParenthesizeChainedOperators`, not `ParenthesizeLogicalOperators`

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants