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

[pylint] Better diagnostic range (PLR1702) #15578

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

InSyncWithFoo
Copy link
Contributor

Summary

Resolves #15570.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Jan 19, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+102 -118 violations, +0 -0 fixes in 11 projects; 44 projects unchanged)

aiven/aiven-client (+1 -1 violations, +0 -0 fixes)

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

- aiven/client/cli.py:860:9: PLR1702 Too many nested blocks (6 > 5)
+ aiven/client/cli.py:882:1: PLR1702 Too many nested blocks (6 > 5)

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

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

- src/plasmapy/analysis/nullpoint.py:1446:5: PLR1702 Too many nested blocks (6 > 5)
+ src/plasmapy/analysis/nullpoint.py:1456:1: PLR1702 Too many nested blocks (6 > 5)

apache/airflow (+27 -31 violations, +0 -0 fixes)

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

- airflow/models/connection.py:421:9: PLR1702 Too many nested blocks (6 > 5)
+ airflow/models/connection.py:427:1: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/commands/release_management_commands.py:2196:5: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/commands/release_management_commands.py:2196:5: PLR1702 Too many nested blocks (7 > 5)
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:2249:1: PLR1702 Too many nested blocks (6 > 5)
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:2261:1: PLR1702 Too many nested blocks (7 > 5)
- dev/breeze/src/airflow_breeze/commands/release_management_commands.py:3485:5: PLR1702 Too many nested blocks (6 > 5)
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:3519:1: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/utils/packages.py:571:5: PLR1702 Too many nested blocks (6 > 5)
+ dev/breeze/src/airflow_breeze/utils/packages.py:581:1: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/utils/reproducible.py:119:5: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/utils/reproducible.py:119:5: PLR1702 Too many nested blocks (6 > 5)
- dev/breeze/src/airflow_breeze/utils/reproducible.py:119:5: PLR1702 Too many nested blocks (6 > 5)
... 45 additional changes omitted for project

apache/superset (+21 -26 violations, +0 -0 fixes)

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

+ superset/migrations/shared/native_filters.py:183:1: PLR1702 Too many nested blocks (6 > 5)
+ superset/migrations/shared/native_filters.py:204:1: PLR1702 Too many nested blocks (7 > 5)
+ superset/migrations/shared/native_filters.py:208:1: PLR1702 Too many nested blocks (7 > 5)
- superset/migrations/shared/native_filters.py:246:5: PLR1702 Too many nested blocks (7 > 5)
+ superset/migrations/shared/native_filters.py:261:1: PLR1702 Too many nested blocks (7 > 5)
- superset/migrations/shared/native_filters.py:287:5: PLR1702 Too many nested blocks (7 > 5)
+ superset/migrations/shared/native_filters.py:343:1: PLR1702 Too many nested blocks (7 > 5)
- superset/migrations/shared/native_filters.py:79:5: PLR1702 Too many nested blocks (6 > 5)
- superset/migrations/shared/native_filters.py:79:5: PLR1702 Too many nested blocks (6 > 5)
- superset/migrations/shared/native_filters.py:79:5: PLR1702 Too many nested blocks (6 > 5)
... 37 additional changes omitted for project

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

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

- samcli/commands/sync/command.py:331:5: PLR1702 Too many nested blocks (7 > 5)
+ samcli/commands/sync/command.py:437:1: PLR1702 Too many nested blocks (7 > 5)
- samcli/lib/package/utils.py:267:5: PLR1702 Too many nested blocks (7 > 5)
+ samcli/lib/package/utils.py:287:1: PLR1702 Too many nested blocks (7 > 5)
+ samcli/lib/utils/subprocess_utils.py:112:1: PLR1702 Too many nested blocks (6 > 5)
- samcli/lib/utils/subprocess_utils.py:88:5: PLR1702 Too many nested blocks (6 > 5)
- samcli/lib/utils/subprocess_utils.py:88:5: PLR1702 Too many nested blocks (6 > 5)

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

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

- src/bokeh/core/query.py:178:5: PLR1702 Too many nested blocks (6 > 5)
- src/bokeh/core/query.py:178:5: PLR1702 Too many nested blocks (6 > 5)
+ src/bokeh/core/query.py:197:1: PLR1702 Too many nested blocks (6 > 5)
+ src/bokeh/core/query.py:199:1: PLR1702 Too many nested blocks (6 > 5)
- tests/unit/bokeh/command/subcommands/test_serve.py:508:5: PLR1702 Too many nested blocks (6 > 5)
+ tests/unit/bokeh/command/subcommands/test_serve.py:526:1: PLR1702 Too many nested blocks (6 > 5)

freedomofpress/securedrop (+2 -2 violations, +0 -0 fixes)

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

- admin/bootstrap.py:79:5: PLR1702 Too many nested blocks (6 > 5)
+ admin/bootstrap.py:88:1: PLR1702 Too many nested blocks (6 > 5)
- securedrop/pretty_bad_protocol/_parsers.py:291:9: PLR1702 Too many nested blocks (6 > 5)
+ securedrop/pretty_bad_protocol/_parsers.py:312:1: PLR1702 Too many nested blocks (6 > 5)

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

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

- ibis/expr/visualize.py:116:5: PLR1702 Too many nested blocks (6 > 5)
- ibis/expr/visualize.py:116:5: PLR1702 Too many nested blocks (7 > 5)
+ ibis/expr/visualize.py:140:1: PLR1702 Too many nested blocks (6 > 5)
+ ibis/expr/visualize.py:146:1: PLR1702 Too many nested blocks (7 > 5)

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

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

- scripts/setup/generate_secrets.py:127:5: PLR1702 Too many nested blocks (6 > 5)
+ scripts/setup/generate_secrets.py:162:1: PLR1702 Too many nested blocks (6 > 5)
+ zerver/lib/events.py:1076:1: PLR1702 Too many nested blocks (6 > 5)
+ zerver/lib/events.py:1125:1: PLR1702 Too many nested blocks (7 > 5)
+ zerver/lib/events.py:1140:1: PLR1702 Too many nested blocks (6 > 5)
+ zerver/lib/events.py:1148:1: PLR1702 Too many nested blocks (7 > 5)
+ zerver/lib/events.py:1284:1: PLR1702 Too many nested blocks (6 > 5)
+ zerver/lib/events.py:1299:1: PLR1702 Too many nested blocks (7 > 5)
+ zerver/lib/events.py:1461:1: PLR1702 Too many nested blocks (6 > 5)
+ zerver/lib/events.py:1475:1: PLR1702 Too many nested blocks (6 > 5)
... 16 additional changes omitted for project

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

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

- src/_pytest/_py/path.py:1201:9: PLR1702 Too many nested blocks (7 > 5)
+ src/_pytest/_py/path.py:1232:1: PLR1702 Too many nested blocks (7 > 5)
- src/_pytest/assertion/rewrite.py:753:9: PLR1702 Too many nested blocks (6 > 5)
+ src/_pytest/assertion/rewrite.py:771:1: PLR1702 Too many nested blocks (6 > 5)
- src/_pytest/fixtures.py:252:5: PLR1702 Too many nested blocks (6 > 5)
+ src/_pytest/fixtures.py:276:1: PLR1702 Too many nested blocks (6 > 5)

astropy/astropy (+28 -30 violations, +0 -0 fixes)

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

- astropy/coordinates/baseframe.py:767:9: PLR1702 Too many nested blocks (6 > 5)
- astropy/coordinates/baseframe.py:767:9: PLR1702 Too many nested blocks (6 > 5)
+ astropy/coordinates/baseframe.py:782:1: PLR1702 Too many nested blocks (6 > 5)
+ astropy/coordinates/baseframe.py:788:1: PLR1702 Too many nested blocks (6 > 5)
- astropy/coordinates/transformations/graph.py:316:9: PLR1702 Too many nested blocks (6 > 5)
+ astropy/coordinates/transformations/graph.py:336:1: PLR1702 Too many nested blocks (6 > 5)
+ astropy/io/ascii/cds.py:111:1: PLR1702 Too many nested blocks (6 > 5)
- astropy/io/ascii/cds.py:84:9: PLR1702 Too many nested blocks (6 > 5)
- astropy/io/ascii/html.py:381:9: PLR1702 Too many nested blocks (7 > 5)
- astropy/io/ascii/html.py:381:9: PLR1702 Too many nested blocks (7 > 5)
- astropy/io/ascii/html.py:381:9: PLR1702 Too many nested blocks (7 > 5)
+ astropy/io/ascii/html.py:426:1: PLR1702 Too many nested blocks (7 > 5)
+ astropy/io/ascii/html.py:446:1: PLR1702 Too many nested blocks (7 > 5)
... 45 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR1702 220 102 118 0 0

@InSyncWithFoo InSyncWithFoo marked this pull request as draft January 19, 2025 00:39
@MichaReiser
Copy link
Member

It would be good to first discuss what the proper ranges are on the relevant issue (it's marked as needs design)

@InSyncWithFoo
Copy link
Contributor Author

(This was only supposed to be a draft, though.) Done.

@InSyncWithFoo InSyncWithFoo marked this pull request as ready for review January 19, 2025 14:43
@MichaReiser MichaReiser marked this pull request as draft January 19, 2025 14:45
@MichaReiser
Copy link
Member

I'll put this back in draft until we aligned on a design on the issue. I'll reply there tomorrow

@MichaReiser MichaReiser added breaking Breaking API change do-not-merge Do not merge this pull request labels Jan 19, 2025
@InSyncWithFoo
Copy link
Contributor Author

InSyncWithFoo commented Jan 19, 2025

That would be the correct decision. I just realized I had a off-by-one bug... (or is it?)

This is not breaking though. The rule is in preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change do-not-merge Do not merge this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PLR1702: Visually noisy diagnostic ranges
2 participants