Skip to content

feat: add mypy command with grouped error output#109

Merged
pszymkowiak merged 3 commits intortk-ai:masterfrom
Rmohid:001-mypy-cmd
Feb 28, 2026
Merged

feat: add mypy command with grouped error output#109
pszymkowiak merged 3 commits intortk-ai:masterfrom
Rmohid:001-mypy-cmd

Conversation

@Rmohid
Copy link
Contributor

@Rmohid Rmohid commented Feb 13, 2026

Summary

  • Add rtk mypy command that parses mypy type checker output, groups errors by file (sorted by error count), shows top error codes summary, and preserves note continuation lines (~80% token reduction)
  • Add discovery registry pattern and hook rewrites for mypy and python -m mypy
  • 11 new tests (324 total), all passing

Test plan

  • All 9 mypy_cmd unit tests pass (grouped output, column numbers, top codes, single code, every error shown, note continuation, fileless errors, no errors, no file limit)
  • Both registry tests pass (test_classify_mypy, test_classify_python_m_mypy)
  • test_patterns_rules_length_match passes (PATTERNS/RULES aligned at 22)
  • Full pre-commit gate: cargo fmt --all --check && cargo clippy --all-targets && cargo test

🤖 Generated with Claude Code

@pszymkowiak
Copy link
Collaborator

Rust code ok, 4 items to address:

  1. Remove specs/ — 533 lines of process docs (spec, plan, tasks, research, checklists). Should not be in the repo.
  2. Clean CLAUDE.md — remove the "Active Technologies" and "Recent Changes" sections added at the bottom. Keep only the module table entry.
  3. Duplicate rtk lint mypy — already merged in feat(python): add lint dispatcher + universal format command #100. Either remove the duplicate parser in lint_cmd.rs or have it delegate to mypy_cmd.
  4. Rebase needed — mergeStateStatus: UNSTABLE.

@FlorianBruniaux
Copy link
Collaborator

Thanks for the mypy support — this fits well in the Python tooling story alongside ruff/pytest/pip.

The PR has a merge conflict with master — could you rebase? A lot has changed since Feb 13 (Python/Go support landed in 0.18.0).

Once rebased, I'll do a proper review. The approach (grouped errors by file, top error codes summary) looks solid from the description.

Robert Mohid and others added 3 commits February 17, 2026 21:08
Add rtk mypy module that parses mypy type checker output, groups errors
by file and error code, and produces compact summaries. Includes
discovery registry pattern, hook rewrites, and 11 new tests (324 total).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove process docs (spec, plan, tasks, research, checklists) from
specs/001-mypy-cmd/ and strip "Active Technologies" / "Recent Changes"
sections from CLAUDE.md per PR rtk-ai#109 review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make lint_cmd.rs delegate to mypy_cmd::filter_mypy_output() instead of
maintaining a separate, less capable implementation. The mypy_cmd version
handles column numbers, note continuations, file-less errors, and shows
full error details. Removes 145 lines of duplicate code + 2 redundant tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Rmohid
Copy link
Contributor Author

Rmohid commented Feb 18, 2026

Addressed all 4 review items:

  1. Removed specs/ -- deleted all 5 process doc files (spec, plan, tasks, research, checklists)
  2. Cleaned CLAUDE.md -- removed "Active Technologies" and "Recent Changes" sections; kept only the mypy module table entry
  3. Deduplicated mypy handler -- made mypy_cmd::filter_mypy_output() public and lint_cmd.rs now delegates to it (removed 145 lines of duplicate code + 2 redundant tests). The mypy_cmd version is more capable: handles column numbers, note continuations, file-less errors, and shows full error details
  4. Rebased on master (c29644b, v0.21.1)

All 387 tests pass, including 11 mypy-specific tests. Zero new clippy warnings.

@Rmohid Rmohid closed this Feb 20, 2026
@Rmohid Rmohid reopened this Feb 20, 2026
@Rmohid
Copy link
Contributor Author

Rmohid commented Feb 20, 2026

@FlorianBruniaux All 4 review items have been addressed (see previous comment for details). Could you remove the awaiting-changes label and merge when ready? Thanks!

@pszymkowiak
Copy link
Collaborator

Clean implementation. lazy_static! for regex, exit code preserved, python3 -m mypy fallback, no production unwrap().

Minor: which_command() duplicates an existing helper in utils.rs. Could use crate::utils::tool_exists() instead, but not a blocker.

LGTM.

@pszymkowiak pszymkowiak merged commit e8ef341 into rtk-ai:master Feb 28, 2026
maxkulish added a commit to maxkulish/rtk that referenced this pull request Mar 2, 2026
Bug fixes (4):
- fix(registry): move "fi"/"done" to IGNORED_EXACT to prevent shadowing
  find commands (rtk-ai#246)
- fix(hook): filter docker compose rewrites to supported subcommands
  only (ps/logs/build), avoid hard failures on up/down/exec (rtk-ai#245)
- fix(git): add is_blob_show_arg() to prevent duplicate output on
  git show rev:path style args (rtk-ai#248)
- fix(go): surface build failures (build-output/build-fail/FailedBuild)
  in go test -json summary (rtk-ai#274)

Features (2):
- feat(mypy): add rtk mypy command with grouped error output, 80% token
  reduction; delegate from lint_cmd.rs; add hook rewrites and registry
  entries (rtk-ai#109)
- feat(gain): add --project/-p flag to scope rtk gain stats to the
  current working directory; add shorten_path() display helper (rtk-ai#128)

Tests: 501 passed (10 new tests added)
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.

3 participants