Skip to content

chore: lint scripts/, and put scripts/ under CI lint - #81

Merged
mspinola merged 1 commit into
mainfrom
chore/lint-scripts
Jul 31, 2026
Merged

mspinola merged 1 commit into
mainfrom
chore/lint-scripts

Conversation

@mspinola

Copy link
Copy Markdown
Owner

scripts/ had never been linted — CI runs ruff check src tests — and had quietly accumulated 26 errors, all in reconcile_volume.py:

Rule Count What
W293 22 blank line contains whitespace
F541 2 f-string with no placeholders
I001 1 unsorted imports
W291 1 trailing whitespace

All autofixable; applied with ruff check --fix scripts/.

Behaviour is unchanged, and that is verified rather than asserted

reconcile_volume.py imports cotdata.providers.norgate, which needs Norgate on Windows, so it cannot be executed on this machine. Instead of hand-waving, the check is token-level:

  • 575 significant tokens before, 575 after (whitespace/comments/newlines excluded).
  • The only differences are the import block regrouped — identical tokens, moved — and two f prefixes dropped from strings containing no placeholders. f"text" and "text" evaluate identically.
  • All five scripts still pass py_compile.
  • No logic line is touched; git diff -w is 4 lines of import reordering plus the 2 f-prefixes.

CI now lints scripts/ too

Decided yes, for three reasons:

  1. The selected rules are mostly not style. Pyflakes F catches undefined names and unused imports — crashes waiting to happen, not formatting opinions.
  2. scripts/vintage_alert_selftest.py is user-facing. Users are told to run it to verify their revision alerting works; a broken diagnostic is worse than none.
  3. An unlinted source root fails open. That is precisely how 26 errors accumulated with nobody noticing.

The trade-off, stated plainly: a future throwaway investigation script now has to pass lint before CI goes green. E501 is already ignored so there is no line-length nagging, and --fix handles nearly everything automatically. To revert, drop scripts from the ruff step — nothing else depends on it.

ruff check src tests scripts clean; 201 tests pass.

🤖 Generated with Claude Code

scripts/ had never been linted -- CI ran 'ruff check src tests' -- and had quietly
accumulated 26 errors, all in reconcile_volume.py: 22 W293 blank-line-with-whitespace,
1 W291 trailing whitespace, 1 I001 unsorted imports, 2 F541 f-strings with no
placeholders. All autofixable, all applied with 'ruff check --fix'.

No behaviour changed, and that is verified rather than asserted: the significant-token
stream is 575 tokens before and after, and the only differences are the import block
regrouped (identical tokens, moved) and two 'f' prefixes dropped from strings containing
no placeholders. f"text" and "text" evaluate identically. All five scripts still
py_compile. reconcile_volume.py needs Norgate/Windows so it cannot be executed here,
which is why the check is token-level rather than behavioural.

CI now lints scripts/ too. The selected rules are mostly not style: pyflakes F catches
undefined names and unused imports, which are crashes waiting to happen, and
scripts/vintage_alert_selftest.py is a diagnostic users are told to run, so a broken one
is worse than none. Leaving a source root unlinted also fails open, which is exactly how
26 errors accumulated unnoticed. The trade-off, stated plainly: a future throwaway
investigation script now has to pass lint before CI goes green. E501 is already ignored
so there is no line-length nagging, and --fix handles nearly everything. To revert, drop
'scripts' from the ruff step; nothing else depends on it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mspinola
mspinola merged commit 987dfef into main Jul 31, 2026
5 checks passed
@mspinola
mspinola deleted the chore/lint-scripts branch July 31, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant