ruff is clean at both scopes — and three of the reports were real - #71
Merged
Conversation
`ruff check shanuz` and `ruff check .` both report zero, down from 51 and 201. Most of it is cleanup — unused imports left behind by the Assay5 refactor, dead locals, semicolon-joined statements — but three of the reports were pointing at something real. `test_anchors_seurat_parity.py` defined test_pca_loadings_are_exact_not_randomized twice (F811). Python keeps the second, so the first never ran. It is not a duplicate: it also proves sklearn's randomized solver *disagrees* on the trailing PCs, which is the whole reason the exact SVD is there. Renamed; it passes. test_sctransform_vars_to_regress_removes_covariate_effect computed a `before` baseline (F841) and never asserted on it — and it was the wrong baseline anyway, taken from a different object built from un-injected counts. Asserting only that the regressed residuals are uncorrelated with the covariate is equally satisfied by a fixture that never carried the covariate. Rewritten to run SCTransform twice over the same injected counts: unregressed 0.25, regressed 0.00. Verified load-bearing by zeroing the injection — the new assertion fires at 0.07 where the old test passed. find_markers raised a constant string for an empty ident_2 (F541) while the ident_1 branch named the ident it looked for. Both name it now, and ident_2=None reports that nothing is left outside ident_1 rather than naming a parameter the caller never passed. Two new tests; that path had no coverage at all. The 121 E402s in tests/ and tutorials/ are the deliberate sys.path bootstrap those files need to run from a clone. Ignored by scope in pyproject.toml rather than by 121 scattered noqa comments. Suite 915 → 918: +1 from the un-shadowed test, +2 new. mypy stays at 0. pbmc3k tutorial re-run end to end and its R comparison is unchanged. 5 mutations, 5 killed. Note CI installs ruff *unpinned* and currently resolves 0.16.0, whose default rule set is much larger (PEP 604 annotations, import sorting): 644 on `shanuz`. Everything here is measured against the pinned local 0.15.20. Closing that gap is a separate call — pin CI, or take the ~500-site annotation rewrite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
ruff check shanuz51 → 0,ruff check .201 → 0.Most of it is what it looks like: unused imports left behind by the Assay5 refactor, dead locals, semicolon-joined statements. But three reports were pointing at something real, and those are the reason this is worth reading.
A test had been shadowed and never ran
test_anchors_seurat_parity.pydefinedtest_pca_loadings_are_exact_not_randomizedat line 275 and again at line 422 (F811). Python keeps the second, so the first was collected by nothing.It is not a duplicate. The surviving copy checks
_pca_loadingsagainstnp.linalg.svdand asserts orthonormality and seed-independence. The shadowed one additionally builds sklearn's randomized result and asserts it disagrees — the guard that the exact SVD is load-bearing rather than an equivalent spelling:That is the assertion behind the 45% → 100% RPCA anchor-recall fix, and it had not executed since it was written. Renamed to
test_randomized_svd_would_visibly_disagree_on_the_trailing_pcs; it passes.A regress-out test with no baseline
test_sctransform_vars_to_regress_removes_covariate_effectcomputedbefore(F841) and never asserted on it — and it was the wrong baseline regardless, taken from a different object built from un-injected counts. What remained was:which is equally satisfied by a fixture that never carried the covariate in the first place. Rewritten to run SCTransform twice over the same injected counts, once plain and once regressing, and to require the signal to be present before requiring its removal: unregressed 0.2526, regressed 0.0000.
Verified the new half is load-bearing by zeroing the injection —
corr_beforedrops to 0.073 and the test now fails there, where the old one passed.find_markersnamed one missing ident but not the otherident_1empty said which ident;ident_2empty raised a constant"No cells found for comparison group."(F541). Both name it now, and sinceident_2=Nonemeans "every other ident", that case reports there is nothing left outsideident_1instead of a parameter the caller never passed. Two new tests — the path had no coverage at all.The rest
Dead locals worth naming: two computed-and-discarded colour maps in
vln_plotanddim_plot, and av3layout flag inread_10xthat no branch consumed.The 121 E402s in
tests/andtutorials/are all one deliberate line — thesys.pathbootstrap those files need to run straight from a clone. Ignored by scope inpyproject.tomlrather than by 121 scattered# noqa: E402.Verification
ruff check shanuzruff check .mypy shanuz+1 from the un-shadowed test, +2 new. The
pbmc3ktutorial was re-run end to end and its--reportagainst Seurat 5.5.1 is unchanged (2,638 barcodes, 2,000 HVGs, kNN 52,760, 8 vs 9 clusters). 5 mutations, 5 killed.One thing this does not fix
CI installs ruff unpinned and currently resolves 0.16.0, whose default rule set is much larger —
uvx ruff@0.16.0 check shanuzreports 644, dominated by UP045/UP037/UP007 (Optional[X]→X | None, ~500 sites) and I001 import sorting. Everything above is measured against the pinned local 0.15.20. Closing that gap is a separate decision: pin ruff in CI, or take the annotation rewrite.🤖 Generated with Claude Code