Fix the lint failures that are failing CI on main (ruff + clippy)#305
Open
HarperZ9 wants to merge 2 commits into
Open
Fix the lint failures that are failing CI on main (ruff + clippy)#305HarperZ9 wants to merge 2 commits into
HarperZ9 wants to merge 2 commits into
Conversation
`lint.select = ["ALL"]` enables FURB110, which flags the
`x if x else {}` ternary in `tests/adaptors/filesystem.py` and fails
`ruff check` on main. Because the lint job runs in the same workflow as
the test matrix, its failure cancels every test job via fail-fast, so
all CI checks show red even though the suite itself passes.
Replace the two ternaries with the idiomatic `or` operator (the rule's
own prescribed fix), which is semantically identical for the falsy-to-{}
default. `ruff check` and `ruff format --check` are both clean with the
pinned ruff 0.14.8.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
After the ruff fix, `just lint` advances to `lint-rust`, where
`cargo clippy -- -D warnings` fails on clippy 1.96's collapsible_match in
`rust/src/import_parsing.rs`: the `Expr::Attribute` match arm wraps an
`if expr.attr.id == "TYPE_CHECKING" { ... } else { walk_stmt(...) }`.
Collapse it into a pattern guard (clippy's own suggested fix). The else
branch was identical to the `_ =>` fallthrough, so when the guard is false
the statement is still walked via that arm. Behavior is unchanged.
Verified with the CI toolchain (rust 1.96.0):
cargo fmt --check -> clean
cargo clippy ... -D warnings -> clean
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
Lint and check docs buildjob is red onmain, which (because it shares the workflow with the test matrix andfail-fastis on) cancels the test jobs too, so every PR shows all-red even though the Python suite passes. The lint job runsjust lint=lint-pythonthenlint-rust, and both halves currently fail from independent tool version bumps:1. Python: ruff
FURB110ruff.tomluseslint.select = ["ALL"], which enablesFURB110("Replace ternaryifexpression withoroperator"), flagging:Fix: replace
x if x else {}with the idiomaticx or {}(the rule's prescribed fix; semantically identical for the falsy-to-{}default).2. Rust: clippy
collapsible_matchWith the Python lint fixed,
just lintproceeds tolint-rust, wherecargo clippy --all-targets --all-features -- -D warningsfails on clippy 1.96'scollapsible_matchinrust/src/import_parsing.rs:131: theExpr::Attributematch arm wraps anif expr.attr.id == "TYPE_CHECKING" { ... } else { walk_stmt(...) }.Fix: collapse it into a pattern guard (clippy's own suggested fix). The
elsebranch was identical to the_ =>fallthrough, so when the guard is false the statement is still walked. Behavior is unchanged.Verification
Python, with the pinned
ruff==0.14.8:Rust, with the CI toolchain
rust 1.96.0:On this PR the
Lint and check docs buildjob now passes, which is the blocker that was cancelling the test matrix.Note on the remaining red
After the lint job goes green the test matrix runs, and
Run tests for Python 3.10, macos-latestfails during the maturin/pyo3 extension build with a macOS linker error (undefined_PyExc_*symbols,clang: linker command failed). That is a native-build/environment issue, not something this lint-only change touches, and I do not have permission to re-run jobs on this repo. A maintainer re-run (or a look at the macOS pyo3 build) would confirm.Disclosure: authored with AI assistance (Claude), reviewed and verified before submitting. Happy to adjust if you would rather handle either lint via config (pinning the tools or scoping the rules) instead.