Skip to content

Turn pylint back on, and triage what it finds #109

Description

@elinscott

The pre-commit job has never run its hooks — it invokes pre-commit run with nothing staged, so every hook skips and the job passes. That is fixed separately in #108; this issue is about the one hook that fix leaves switched off.

Running pre-commit run --all-files against main gives 37 pylint findings across 21 modules. Turning the hook on in the same pull request would have meant either fixing all of them blind or leaving CI red, so it is disabled there with a comment, and the work is recorded here.

Two separate questions:

  • Which pylint? The hook is configured language: system, so it runs whatever the [pre-commit] extra installs — currently pylint>=3, which resolves to 4.0.7. This codebase has never been through pylint 4, so some part of those 37 findings is a new major version's opinions rather than drift in the code. Pinning the hook to a known version would make the count mean something and stop it moving underfoot.

  • Eight of the findings look like real bugs. Most of the 37 are style — too-many-positional-arguments, an unnecessary elif — but these are possibly-used-before-assignment or used-before-assignment, which is pylint reporting a path where a name is read before every branch has bound it:

    • workflows/optimize.py (two findings)
    • workflows/bands.py
    • utils/parser/center.py
    • utils/pseudo/upf.py
    • utils/workflows/plot/distance.py (three findings)

Suggested order:

  1. pin the pylint version
  2. triage the eight above and fix/dismiss each
  3. clear the remaining style findings
  4. drop the pylint exclusion from .pre-commit-config.yaml

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions