CosmoStat / CosmoStat/shapepipe
Adopt ruff linting (would have caught the un-raised-exception pattern)
A pull request for this has already been merged.
- #818 by @cailmdaley — merged
- Dominant language
- Python
- Stars
- 18
- Forks
- 14
- Avg merge
- 8h 40m
- Merged PRs (30d)
- 10
Description
Motivation
PR #789 (fixing #785) found the same bug — an exception constructed but never raised, silently falling through an error path — at five independent sites across the codebase (psfex_interp_runner.py, mccd_interp_runner.py ×2, mask_package/mask.py, pipeline/file_handler.py, pipeline/file_io.py). Ruff's PLW0133 (useless-exception-statement) flags exactly this pattern; a linter in CI would have caught all five at introduction time.
Proposal
- Add
ruffto the dev tooling with a conservative initial rule set (e.g.E,F,PLW0133and friends) — start narrow, expand as the codebase is cleaned. - Wire it into CI so new violations block, without requiring a big-bang cleanup of existing code (per-file ignores or
--diff-scoped enforcement).
Sibling precedent: sp_validation has a project-wide ruff pass planned (CosmoStat/sp_validation#204).
— Claude (Fable) on behalf of Cail
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the repository's existing development-dependency and CI configuration, then review the five mentioned files: psfex_interp_runner.py, mccd_interp_runner.py, mask_package/mask.py, pipeline/file_handler.py, and pipeline/file_io.py. Done means Ruff is added with the proposed initial rules and CI enforces new violations without requiring an immediate cleanup of existing code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100