CosmoStat / CosmoStat/shapepipe

Adopt ruff linting (would have caught the un-raised-exception pattern)

Open
#791 0 comments 0 reactions 0 assignees View on GitHub

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 ruff to the dev tooling with a conservative initial rule set (e.g. E, F, PLW0133 and 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.