Fix pre-existing ruff and mypy strict-mode violations#28
Closed
Fix pre-existing ruff and mypy strict-mode violations#28
Conversation
Clean up lint/type errors that existed on main but had not been
addressed. These were blocking `uv run ruff check .` and
`uv run mypy scripts/` from returning clean, making it hard to tell
real issues from baseline noise in future PRs.
- trigger.py, post-tool-use.py: Import `typing.Any`, parameterise
`dict` annotations as `dict[str, Any]` on load_config, handle_stop,
handle_pre_tool_use, and stdin parsing locals.
- trigger.py, post-tool-use.py: Annotate `main() -> None` so the
top-level `if __name__ == "__main__": main()` call is no longer a
no-any-return violation.
- post-tool-use.py: Narrow `handle_git_commit`'s return type from
`dict | None` to `dict[str, str] | None` to match the actual
`{"hash": ..., "message": ...}` shape.
- test_trigger.py: Move `import importlib` to the top-level imports
block so it no longer trips E402 after the `sys.path.insert` call.
Pure cleanup - no runtime behaviour changes. All 123 tests still pass.
severity1
added a commit
that referenced
this pull request
Apr 11, 2026
5 tasks
Owner
Author
|
Absorbed into PR #27 (fix/subagent-stop-cleanup-and-windows-paths). All type annotation changes from this branch have been merged there directly. 132 tests passing, ruff and mypy clean. |
severity1
added a commit
that referenced
this pull request
Apr 11, 2026
…ns (#28) - Add ^ anchor to SubagentStop matcher regex to prevent partial matches - Instruct Stop/PreToolUse hooks to set subagent_type='auto-memory:memory-updater' so Claude Code can match the SubagentStop hook against the spawned agent - Bump to v0.8.4
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.
Summary
Cleans up 12 pre-existing lint/type errors on
mainthat were blockinguv run ruff check .anduv run mypy scripts/from returning clean:E402intests/test_trigger.py-import importlibsat below asys.path.insertcall.importlibis stdlib and has no path dependency, so it moves cleanly to the top-of-file imports block.dict,no-any-returnonjson.load, untypedmain()functions, and an overly loose return type onhandle_git_commit.These existed on
mainbefore any recent PRs - verified viagit stash+ baseline run. No runtime behaviour changes in this PR.Why bother
Baseline noise in lint/type output makes it hard to tell real issues from accepted ones in future PRs. With the baseline clean, any new violation stands out immediately instead of being hidden in a pile of 12 pre-existing errors. This is groundwork for eventually adding these checks to a pre-commit hook or GitHub Action.
Changes
scripts/trigger.pytyping.Any;dict->dict[str, Any]onload_config,handle_stop,handle_pre_tool_use; annotatemain() -> None; typed local for stdin parsescripts/post-tool-use.pytyping.Any+dict[str, Any]treatment onload_configandmain(); narrowhandle_git_commitreturn todict[str, str] | Nonematching the real{"hash", "message"}shapetests/test_trigger.pyimport importlibto top-level importsVerification
Test plan
uv run ruff check .cleanuv run ruff format --check .cleanuv run mypy scripts/cleanuv run pytest tests/123/123 passingRelationship to #27
Independent cleanup PR. #27 fixes bugs; this one fixes the baseline. Merging either first works; if #27 merges first, a trivial rebase may be needed here.