Skip to content

[pylint] Stabilize len-test (PLC1802) #16626

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

Merged
merged 1 commit into from
Mar 11, 2025
Merged

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Mar 11, 2025

Summary

Stabilizes PLC1802. The tests were already in the right place, and I just tidied the docs a little bit.

Test Plan

1 issue closed 4 days after the rule was added, no other issues

Summary
--

Stabilizes PLC1802. The tests were already in the right place, and I just
tidied the docs a little bit.

Test Plan
--

1 issue closed 4 days after the rule was added, no other issues
@ntBre ntBre added the rule Implementing or modifying a lint rule label Mar 11, 2025
@ntBre ntBre added this to the v0.10 milestone Mar 11, 2025
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

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

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

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

+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:1743:8: PLC1802 [*] `len(success_entries)` used as condition without comparison
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:1750:8: PLC1802 [*] `len(skipped_entries)` used as condition without comparison
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:1855:12: PLC1802 [*] `len(success_entries)` used as condition without comparison
+ dev/breeze/src/airflow_breeze/commands/release_management_commands.py:1862:12: PLC1802 [*] `len(skipped_entries)` used as condition without comparison
+ providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py:268:16: PLC1802 [*] `len(fetched_logs)` used as condition without comparison
+ providers/sftp/src/airflow/providers/sftp/sensors/sftp.py:132:16: PLC1802 [*] `len(files_found)` used as condition without comparison
+ providers/snowflake/src/airflow/providers/snowflake/operators/snowflake.py:474:20: PLC1802 [*] `len(queries_in_progress)` used as condition without comparison

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

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

+ superset/databases/filters.py:98:16: PLC1802 [*] `len(allowed_schemas)` used as condition without comparison
+ superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py:444:61: PLC1802 [*] `len(SEQUENCE)` used as condition without comparison
+ superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py:546:11: PLC1802 [*] `len(ordered_raw_positions)` used as condition without comparison
+ superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py:559:16: PLC1802 [*] `len(available_columns_index)` used as condition without comparison
+ superset/migrations/versions/2018-11-12_13-31_4ce8df208545_migrate_time_range_for_default_filters.py:68:24: PLC1802 [*] `len(keys)` used as condition without comparison

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

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

+ src/bokeh/core/validation/check.py:216:27: PLC1802 [*] `len(warnings)` used as condition without comparison

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

+ pandas/core/arrays/string_arrow.py:284:16: PLC1802 [*] `len(value_set)` used as condition without comparison
+ pandas/core/groupby/generic.py:2508:16: PLC1802 [*] `len(results)` used as condition without comparison
+ pandas/core/groupby/groupby.py:5177:16: PLC1802 [*] `len(to_coerce)` used as condition without comparison
+ pandas/core/internals/blocks.py:811:16: PLC1802 [*] `len(pairs)` used as condition without comparison
+ pandas/core/internals/construction.py:867:8: PLC1802 [*] `len(contents)` used as condition without comparison
+ pandas/core/internals/managers.py:1301:12: PLC1802 [*] `len(removed_blknos)` used as condition without comparison
+ pandas/io/pytables.py:1763:16: PLC1802 [*] `len(lkeys)` used as condition without comparison
+ pandas/io/pytables.py:4543:12: PLC1802 [*] `len(masks)` used as condition without comparison
+ pandas/io/pytables.py:4663:20: PLC1802 [*] `len(groups)` used as condition without comparison
+ pandas/io/sql.py:2618:12: PLC1802 [*] `len(ix_cols)` used as condition without comparison

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

+ testing/_py/test_local.py:218:16: PLC1802 [*] `len(lst)` used as condition without comparison

astropy/astropy (+5 -0 violations, +0 -0 fixes)

+ astropy/io/ascii/misc.py:83:12: PLC1802 [*] `len(first)` used as condition without comparison
+ astropy/units/core.py:1331:16: PLC1802 [*] `len(subresults)` used as condition without comparison
+ astropy/units/core.py:2549:12: PLC1802 [*] `len(names)` used as condition without comparison
+ astropy/wcs/wcs.py:2950:16: PLC1802 [*] `len(missing_keys)` used as condition without comparison
+ astropy/wcs/wcs.py:3765:20: PLC1802 [*] `len(content)` used as condition without comparison

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLC1802 29 29 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre
Copy link
Contributor Author

ntBre commented Mar 11, 2025

The ecosystem results look right to me. I checked that they were all len(...) calls and also that the ... was a sequence. There was one case where it wasn't obvious to me that it was a sequence, but it looks like the simple type inference looked at the class definition with an annotation and got it right.

@ntBre ntBre merged commit 303b061 into micha/ruff-0.10 Mar 11, 2025
21 checks passed
@ntBre ntBre deleted the brent/plc1802-0.10 branch March 11, 2025 15:30
@ntBre ntBre mentioned this pull request Mar 11, 2025
2 tasks
MichaReiser pushed a commit that referenced this pull request Mar 13, 2025
Summary
--

Stabilizes PLC1802. The tests were already in the right place, and I
just tidied the docs a little bit.

Test Plan
--

1 issue closed 4 days after the rule was added, no other issues
MichaReiser pushed a commit that referenced this pull request Mar 13, 2025
Summary
--

Stabilizes PLC1802. The tests were already in the right place, and I
just tidied the docs a little bit.

Test Plan
--

1 issue closed 4 days after the rule was added, no other issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants