Skip to content

Maintainability: enforce lint/types in CI, split cli.py, measure coverage#9

Merged
moonrunnerkc merged 7 commits into
mainfrom
maintainability-improvements
Jun 8, 2026
Merged

Maintainability: enforce lint/types in CI, split cli.py, measure coverage#9
moonrunnerkc merged 7 commits into
mainfrom
maintainability-improvements

Conversation

@moonrunnerkc

Copy link
Copy Markdown
Owner

Four behavior-preserving maintainability improvements. CLI exit codes, stderr text, rule IDs, and flag semantics are unchanged; the full suite (786 collected) stays green.

Changes

  • CI enforces lint + types. The lint job now installs the dev extras and runs ruff check src tests and mypy src/skillcheck (strict); either finding fails the job, replacing the prior compileall-only check.
  • ruff + mypy config. Added [tool.ruff] (pinned E, F, I, UP, B, target-version py310, line length 127) and [tool.mypy] (strict, python_version 3.10, files = ["src/skillcheck"]). Untyped optional deps (tiktoken, plus the tomllib 3.11+ backport branch) use ignore_missing_imports overrides rather than blanket ignores. Source brought clean under both with real annotations.
  • Split cli.py. Argument wiring (parser, skillcheck.toml application, mode-conflict dispatch, main) stays in cli.py; per-mode handlers and the path/ingest IO helpers move to a new skillcheck.commands module. cli.py dropped 1,011 to 546 lines. skillcheck.cli:main and the console script are unchanged; handler bodies moved verbatim.
  • Coverage. Added pytest-cov to the dev extras and [tool.coverage.*] config; addopts enforces --cov=skillcheck --cov-fail-under=68 on every run (CI inherits it). Floor sits below the ~72% measured on CPython 3.10 to absorb matrix variance (subprocess-invoked CLI modules, the tomllib branch flip across Python versions, Windows-skipped tests).

Verification (local)

  • pip install -e ".[dev]" clean
  • ruff check src tests passes
  • mypy src/skillcheck passes (strict, 46 files)
  • pytest 784 passed, 2 skipped; coverage 71.62% >= 68%
  • exit codes spot-checked: pass 0, errors 1, bad args 2, ingested semantic error 3

No version bump, no tags (release is a manual maintainer step). CHANGELOG [Unreleased] has one entry per task.

Brad Kinnard added 7 commits June 7, 2026 20:11
Pin an explicit ruff selection (E, F, I, UP, B) at line length 127 and run
mypy in strict mode over src/skillcheck under python_version 3.10. tiktoken
and the tomllib 3.11+ backport branch are untyped, so they get
ignore_missing_imports overrides rather than inline blanket ignores.

Source and tests are brought clean under both: real annotations on the
agent and history dict helpers, import sorting, zip(strict=True) where the
inputs are known equal length, and removal of unused imports. CLI tests now
invoke the package via SKILLCHECK_CMD ([sys.executable, "-m", "skillcheck"])
and skip on CLI_AVAILABLE, matching the pattern documented in
.github/CLAUDE.md. No runtime behavior changes.
The lint job previously ran only python -m compileall, which catches syntax
errors but not lint or type findings. Install the dev extras and run
ruff check src tests and mypy src/skillcheck (strict); either failing now
fails the job. ruff's parse step subsumes the compileall check.
cli.py was about 1,010 lines, roughly twice the next-largest module, mixing
argparse wiring with the work each mode performs. Move the per-mode handlers
(emit prompts and graphs, --show-history, the default validation pipeline)
and the path and ingest IO helpers into a new skillcheck.commands module.
cli.py keeps the parser, config application, mode-conflict dispatch, and
main. Function bodies move verbatim, so exit codes, stderr text, and output
are unchanged. The console script and skillcheck.cli:main entry point are
untouched.
Add pytest-cov to the dev extra and configure coverage under
[tool.coverage.run] / [tool.coverage.report]. addopts gains
--cov=skillcheck --cov-report=term-missing --cov-fail-under=68 so the floor
runs on every pytest invocation, including the CI test job.

The floor is set a few points below the ~72% line coverage measured on
CPython 3.10. The headroom covers matrix variance: cli.py and commands.py
execute in subprocesses the in-process tracer cannot see, the tomllib branch
in config_loader differs between 3.10 and 3.11+, and a handful of tests skip
on Windows.
@moonrunnerkc moonrunnerkc merged commit 6a477c2 into main Jun 8, 2026
14 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