feat: Ruff T20 (print) lint and test-module reminder hook#29
Merged
Conversation
- Enable Ruff flake8-print (T20) in generated projects and this repo; allow print in tests/, scripts/, and bump_version.py via per-file-ignores. - Extend pre-config-protection to block silencing T20/T201 in the global ruff ignore list. - Add pre-write-src-test-reminder.sh (PreToolUse): non-blocking warning when tests/<pkg>/test_<module>.py is missing for top-level src/<pkg>/<module>.py. - Register the hook in template and root .claude/settings.json; document in hook READMEs and python/hooks.md. - Add test_generated_pyproject_ruff_includes_print_rules. Made-with: Cursor
934a3cb to
83cd2e2
Compare
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
template/pyproject.toml.jinjaand the meta-repopyproject.toml, soruff check(PostToolUse hook, pre-commit, CI) flagsprint()in application code as T201.tests/**,scripts/**, andsrc/**/bump_version.pymay still useprint().ignorelist (same spirit as existing D/E/F/I/B guards).tests/<pkg>/test_<module>.pyis missing for top-levelsrc/<pkg>/<module>.py(excludes__init__.pyand nested paths likesrc/<pkg>/common/...to avoid noise vs shared tests such astest_support.py)..claude/per template maintenance practice; docs updated;test_generated_pyproject_ruff_includes_print_rulesasserts the renderedpyproject.toml.Notes
just cimay fail onjust auditin some environments (pip-audit/venv);ruff check,basedpyright, andjust test-ciwere verified passing.Made with Cursor