Skip to content
New issue

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

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

Already on GitHub? # to your account

[pylint] Remove try body from branch counting #11487

Merged
merged 1 commit into from
May 22, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

Matching Pylint, we now omit the try body itself from branch counting. Each except counts as a branch, as does the else and the finally.

Closes #11205.

@charliermarsh charliermarsh added the bug Something isn't working label May 22, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

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

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

+ src/plasmapy/particles/_parsing.py:152:32: RUF100 [*] Unused `noqa` directive (unused: `PLR0912`)
+ src/plasmapy/utils/decorators/validators.py:289:30: RUF100 [*] Unused `noqa` directive (unused: `PLR0912`)

apache/airflow (+73 -87 violations, +0 -0 fixes)

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

- airflow/api/common/airflow_health.py:29:5: PLR0912 Too many branches (14 > 12)
- airflow/api_connexion/endpoints/log_endpoint.py:45:5: PLR0912 Too many branches (13 > 12)
+ airflow/api_connexion/endpoints/task_instance_endpoint.py:158:5: PLR0912 Too many branches (15 > 12)
- airflow/api_connexion/endpoints/task_instance_endpoint.py:158:5: PLR0912 Too many branches (16 > 12)
+ airflow/cli/commands/connection_command.py:209:5: PLR0912 Too many branches (18 > 12)
- airflow/cli/commands/connection_command.py:209:5: PLR0912 Too many branches (19 > 12)
+ airflow/cli/commands/db_command.py:98:5: PLR0912 Too many branches (15 > 12)
- airflow/cli/commands/db_command.py:98:5: PLR0912 Too many branches (17 > 12)
+ airflow/cli/commands/task_command.py:403:5: PLR0912 Too many branches (14 > 12)
- airflow/cli/commands/task_command.py:403:5: PLR0912 Too many branches (16 > 12)
+ airflow/cli/commands/task_command.py:630:5: PLR0912 Too many branches (17 > 12)
- airflow/cli/commands/task_command.py:630:5: PLR0912 Too many branches (18 > 12)
+ airflow/configuration.py:1343:9: PLR0912 Too many branches (13 > 12)
- airflow/configuration.py:1343:9: PLR0912 Too many branches (15 > 12)
- airflow/dag_processing/manager.py:1122:9: PLR0912 Too many branches (13 > 12)
+ airflow/dag_processing/manager.py:543:9: PLR0912 Too many branches (24 > 12)
- airflow/dag_processing/manager.py:543:9: PLR0912 Too many branches (25 > 12)
+ airflow/dag_processing/processor.py:421:9: PLR0912 Too many branches (27 > 12)
- airflow/dag_processing/processor.py:421:9: PLR0912 Too many branches (30 > 12)
- airflow/datasets/__init__.py:52:5: PLR0912 Too many branches (13 > 12)
+ airflow/jobs/backfill_job_runner.py:465:9: PLR0912 Too many branches (23 > 12)
- airflow/jobs/backfill_job_runner.py:465:9: PLR0912 Too many branches (25 > 12)
+ airflow/jobs/backfill_job_runner.py:497:17: PLR0912 Too many branches (25 > 12)
- airflow/jobs/backfill_job_runner.py:497:17: PLR0912 Too many branches (26 > 12)
+ airflow/jobs/backfill_job_runner.py:899:9: PLR0912 Too many branches (16 > 12)
- airflow/jobs/backfill_job_runner.py:899:9: PLR0912 Too many branches (17 > 12)
+ airflow/jobs/scheduler_job_runner.py:298:9: PLR0912 Too many branches (29 > 12)
- airflow/jobs/scheduler_job_runner.py:298:9: PLR0912 Too many branches (30 > 12)
+ airflow/jobs/scheduler_job_runner.py:804:9: PLR0912 Too many branches (13 > 12)
- airflow/jobs/scheduler_job_runner.py:804:9: PLR0912 Too many branches (16 > 12)
... 130 additional changes omitted for project

bokeh/bokeh (+5 -7 violations, +0 -0 fixes)

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

- src/bokeh/core/has_props.py:615:9: PLR0912 Too many branches (13 > 12)
+ src/bokeh/core/property/bases.py:342:9: PLR0912 Too many branches (16 > 12)
- src/bokeh/core/property/bases.py:342:9: PLR0912 Too many branches (17 > 12)
+ src/bokeh/core/query.py:110:5: PLR0912 Too many branches (24 > 12)
- src/bokeh/core/query.py:110:5: PLR0912 Too many branches (25 > 12)
+ src/bokeh/embed/bundle.py:259:5: PLR0912 Too many branches (16 > 12)
- src/bokeh/embed/bundle.py:259:5: PLR0912 Too many branches (17 > 12)
+ src/bokeh/plotting/_graph.py:54:5: PLR0912 Too many branches (17 > 12)
- src/bokeh/plotting/_graph.py:54:5: PLR0912 Too many branches (19 > 12)
+ src/bokeh/server/server.py:351:9: PLR0912 Too many branches (13 > 12)
... 2 additional changes omitted for project

zulip/zulip (+40 -50 violations, +0 -0 fixes)

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

+ corporate/lib/stripe.py:5376:5: PLR0912 Too many branches (14 > 12)
- corporate/lib/stripe.py:5376:5: PLR0912 Too many branches (16 > 12)
+ corporate/lib/support.py:227:5: PLR0912 Too many branches (13 > 12)
- corporate/lib/support.py:227:5: PLR0912 Too many branches (14 > 12)
- corporate/views/installation_activity.py:92:5: PLR0912 Too many branches (13 > 12)
+ corporate/views/remote_billing_page.py:159:5: PLR0912 Too many branches (18 > 12)
- corporate/views/remote_billing_page.py:159:5: PLR0912 Too many branches (21 > 12)
+ corporate/views/support.py:335:5: PLR0912 Too many branches (31 > 12)
- corporate/views/support.py:335:5: PLR0912 Too many branches (34 > 12)
+ corporate/views/support.py:629:5: PLR0912 Too many branches (32 > 12)
- corporate/views/support.py:629:5: PLR0912 Too many branches (37 > 12)
- corporate/views/webhook.py:22:5: PLR0912 Too many branches (16 > 12)
+ tools/lib/provision.py:342:5: PLR0912 Too many branches (14 > 12)
- tools/lib/provision.py:342:5: PLR0912 Too many branches (18 > 12)
+ tools/lib/provision_inner.py:216:5: PLR0912 Too many branches (24 > 12)
- tools/lib/provision_inner.py:216:5: PLR0912 Too many branches (25 > 12)
+ tools/lib/template_parser.py:54:5: PLR0912 Too many branches (36 > 12)
... 73 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PLR0912 262 118 144 0 0
RUF100 2 2 0 0 0

Linter (preview)

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

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

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

+ src/plasmapy/particles/_parsing.py:152:32: RUF100 [*] Unused `noqa` directive (unused: `PLR0912`)
+ src/plasmapy/utils/decorators/validators.py:289:30: RUF100 [*] Unused `noqa` directive (unused: `PLR0912`)

apache/airflow (+73 -87 violations, +0 -0 fixes)

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

- airflow/api/common/airflow_health.py:29:5: PLR0912 Too many branches (14 > 12)
- airflow/api_connexion/endpoints/log_endpoint.py:45:5: PLR0912 Too many branches (13 > 12)
+ airflow/api_connexion/endpoints/task_instance_endpoint.py:158:5: PLR0912 Too many branches (15 > 12)
- airflow/api_connexion/endpoints/task_instance_endpoint.py:158:5: PLR0912 Too many branches (16 > 12)
+ airflow/cli/commands/connection_command.py:209:5: PLR0912 Too many branches (18 > 12)
- airflow/cli/commands/connection_command.py:209:5: PLR0912 Too many branches (19 > 12)
+ airflow/cli/commands/db_command.py:98:5: PLR0912 Too many branches (15 > 12)
- airflow/cli/commands/db_command.py:98:5: PLR0912 Too many branches (17 > 12)
+ airflow/cli/commands/task_command.py:403:5: PLR0912 Too many branches (14 > 12)
- airflow/cli/commands/task_command.py:403:5: PLR0912 Too many branches (16 > 12)
+ airflow/cli/commands/task_command.py:630:5: PLR0912 Too many branches (17 > 12)
- airflow/cli/commands/task_command.py:630:5: PLR0912 Too many branches (18 > 12)
+ airflow/configuration.py:1343:9: PLR0912 Too many branches (13 > 12)
- airflow/configuration.py:1343:9: PLR0912 Too many branches (15 > 12)
- airflow/dag_processing/manager.py:1122:9: PLR0912 Too many branches (13 > 12)
+ airflow/dag_processing/manager.py:543:9: PLR0912 Too many branches (24 > 12)
- airflow/dag_processing/manager.py:543:9: PLR0912 Too many branches (25 > 12)
+ airflow/dag_processing/processor.py:421:9: PLR0912 Too many branches (27 > 12)
- airflow/dag_processing/processor.py:421:9: PLR0912 Too many branches (30 > 12)
- airflow/datasets/__init__.py:52:5: PLR0912 Too many branches (13 > 12)
+ airflow/jobs/backfill_job_runner.py:465:9: PLR0912 Too many branches (23 > 12)
- airflow/jobs/backfill_job_runner.py:465:9: PLR0912 Too many branches (25 > 12)
+ airflow/jobs/backfill_job_runner.py:497:17: PLR0912 Too many branches (25 > 12)
- airflow/jobs/backfill_job_runner.py:497:17: PLR0912 Too many branches (26 > 12)
+ airflow/jobs/backfill_job_runner.py:899:9: PLR0912 Too many branches (16 > 12)
- airflow/jobs/backfill_job_runner.py:899:9: PLR0912 Too many branches (17 > 12)
+ airflow/jobs/scheduler_job_runner.py:298:9: PLR0912 Too many branches (29 > 12)
- airflow/jobs/scheduler_job_runner.py:298:9: PLR0912 Too many branches (30 > 12)
+ airflow/jobs/scheduler_job_runner.py:804:9: PLR0912 Too many branches (13 > 12)
- airflow/jobs/scheduler_job_runner.py:804:9: PLR0912 Too many branches (16 > 12)
... 130 additional changes omitted for project

bokeh/bokeh (+5 -7 violations, +0 -0 fixes)

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

- src/bokeh/core/has_props.py:615:9: PLR0912 Too many branches (13 > 12)
+ src/bokeh/core/property/bases.py:342:9: PLR0912 Too many branches (16 > 12)
- src/bokeh/core/property/bases.py:342:9: PLR0912 Too many branches (17 > 12)
+ src/bokeh/core/query.py:110:5: PLR0912 Too many branches (24 > 12)
- src/bokeh/core/query.py:110:5: PLR0912 Too many branches (25 > 12)
+ src/bokeh/embed/bundle.py:259:5: PLR0912 Too many branches (16 > 12)
- src/bokeh/embed/bundle.py:259:5: PLR0912 Too many branches (17 > 12)
+ src/bokeh/plotting/_graph.py:54:5: PLR0912 Too many branches (17 > 12)
- src/bokeh/plotting/_graph.py:54:5: PLR0912 Too many branches (19 > 12)
+ src/bokeh/server/server.py:351:9: PLR0912 Too many branches (13 > 12)
... 2 additional changes omitted for project

zulip/zulip (+40 -50 violations, +0 -0 fixes)

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

+ corporate/lib/stripe.py:5376:5: PLR0912 Too many branches (14 > 12)
- corporate/lib/stripe.py:5376:5: PLR0912 Too many branches (16 > 12)
+ corporate/lib/support.py:227:5: PLR0912 Too many branches (13 > 12)
- corporate/lib/support.py:227:5: PLR0912 Too many branches (14 > 12)
- corporate/views/installation_activity.py:92:5: PLR0912 Too many branches (13 > 12)
+ corporate/views/remote_billing_page.py:159:5: PLR0912 Too many branches (18 > 12)
- corporate/views/remote_billing_page.py:159:5: PLR0912 Too many branches (21 > 12)
+ corporate/views/support.py:335:5: PLR0912 Too many branches (31 > 12)
- corporate/views/support.py:335:5: PLR0912 Too many branches (34 > 12)
+ corporate/views/support.py:629:5: PLR0912 Too many branches (32 > 12)
- corporate/views/support.py:629:5: PLR0912 Too many branches (37 > 12)
- corporate/views/webhook.py:22:5: PLR0912 Too many branches (16 > 12)
+ tools/lib/provision.py:342:5: PLR0912 Too many branches (14 > 12)
- tools/lib/provision.py:342:5: PLR0912 Too many branches (18 > 12)
+ tools/lib/provision_inner.py:216:5: PLR0912 Too many branches (24 > 12)
- tools/lib/provision_inner.py:216:5: PLR0912 Too many branches (25 > 12)
+ tools/lib/template_parser.py:54:5: PLR0912 Too many branches (36 > 12)
... 73 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PLR0912 262 118 144 0 0
RUF100 2 2 0 0 0

@charliermarsh charliermarsh merged commit 8848eca into main May 22, 2024
19 checks passed
@charliermarsh charliermarsh deleted the charlie/branch branch May 22, 2024 03:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PLR0912: Pylint counts try: ... except: statements as single branch
1 participant