Maintainability: enforce lint/types in CI, split cli.py, measure coverage#9
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
lintjob now installs the dev extras and runsruff check src testsandmypy src/skillcheck(strict); either finding fails the job, replacing the priorcompileall-only check.[tool.ruff](pinnedE, 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 thetomllib3.11+ backport branch) useignore_missing_importsoverrides rather than blanket ignores. Source brought clean under both with real annotations.skillcheck.tomlapplication, mode-conflict dispatch,main) stays incli.py; per-mode handlers and the path/ingest IO helpers move to a newskillcheck.commandsmodule.cli.pydropped 1,011 to 546 lines.skillcheck.cli:mainand the console script are unchanged; handler bodies moved verbatim.pytest-covto the dev extras and[tool.coverage.*]config;addoptsenforces--cov=skillcheck --cov-fail-under=68on 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]"cleanruff check src testspassesmypy src/skillcheckpasses (strict, 46 files)pytest784 passed, 2 skipped; coverage 71.62% >= 68%No version bump, no tags (release is a manual maintainer step). CHANGELOG
[Unreleased]has one entry per task.