Skip to content

chore(checks): add local quality checks and CI ratchets - #961

Merged
PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:stack/02-quality-checks
Sep 21, 2026
Merged

PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:stack/02-quality-checks

Conversation

@PaulHax

@PaulHax PaulHax commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Adds quality ratchets that run in the pre-commit hook and in CI. Each one compares the files a change touches with the base, so a change can lower the debt it touches but not add to it. Existing debt is left alone until someone edits that file.

The checks (node scripts/checks/check.mjs, limits in scripts/checks/config.mjs)

  • Complexity: in src, a function stays within cyclomatic complexity 10, nesting depth 3 and 4 parameters, and a file within 600 lines. A file already over a limit may not get worse.
  • Duplication: a change to the tests may not add a block of 60 or more tokens that repeats another test. Uses jscpd.
  • Conventions: no new binary files outside the directories that already hold them, such as tests/baseline.

Locally the hook compares staged content with HEAD. In CI a new "Quality ratchets" step in the checks workflow compares with the pull request's target branch. It is skipped for merge queue runs, which have no target branch to compare with. CONTRIBUTING.md describes the checks and how to run them by hand.

ESLint

  • Warn-level limits that mirror the ratchet thresholds, so editors surface them before the hook does. npm run lint reports the existing debt as 87 warnings and no errors.
  • A node-globals block for the .mjs tooling, and scripts/**/*.mjs joins lint and lint-staged.
  • Each pure layer is guarded by its one list of pure files: a pure file may import from its own feature only what is on that list, spelled from the @/src/ alias. The processing engine's sibling imports move to the alias to match. A boundary is also declared for src/segmentation. Those files do not exist yet, so its rules match nothing for now.

Adds scripts/checks: complexity, duplication and convention ratchets that the
pre-commit hook runs on staged content and that CI runs against the base of
the pull request, so a change can only lower the debt it touches. Extends
lint-staged and the lint script to the scripts directory.

The eslint config gains the segmentation feature boundary ahead of the module
landing, a node-globals block for .mjs tooling, and warn-level limits that
mirror the ratchet thresholds so editors surface them. Each pure layer is
guarded by its one list of pure files: a pure file may import from its own
feature only what is on that list, spelled from the alias, so the processing
engine's sibling imports move to the alias.
@netlify

netlify Bot commented Sep 21, 2026

Copy link
Copy Markdown

Deploy Preview for volview-dev ready!

Name Link
🔨 Latest commit cff3873
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6ab187e72920150008a18371
😎 Deploy Preview https://deploy-preview-961--volview-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@PaulHax
PaulHax merged commit 8357125 into Kitware:main Sep 21, 2026
8 checks passed
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