Skip to content

Add check-banned-words hook to enforce generic hook scripts#1687

Merged
nathanjmcdougall merged 5 commits intomainfrom
copilot/add-hook-to-ban-words
Apr 1, 2026
Merged

Add check-banned-words hook to enforce generic hook scripts#1687
nathanjmcdougall merged 5 commits intomainfrom
copilot/add-hook-to-ban-words

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Hooks in hooks/ should be project-agnostic and not reference the package name. This adds a hook to enforce that invariant and fixes existing violations.

New hook: hooks/check-banned-words.py

  • Scans all .py files in the hooks directory for banned words (passed as positional CLI args)
  • Uses \b word-boundary matching to avoid false positives
  • Excludes itself from scanning

Existing hooks generalized

  • check-skills-documented.py / export-skills-directory.py: --prefix changed from default="usethis-" to required=True
  • check-test-skeleton.py: help text example changed from 'tests/usethis' to 'tests/mypackage'

Pre-commit config

  • Registered check-banned-words with args: ["--hooks-dir=hooks", "usethis"]
  • Added explicit --prefix=usethis- to export-skills-directory args (previously relied on the now-removed default)

Copilot AI and others added 2 commits April 1, 2026 04:24
Copilot AI changed the title [WIP] Add a hook to ban a list of words from hooks directory Add check-banned-words hook to enforce generic hook scripts Apr 1, 2026
Copilot AI requested a review from nathanjmcdougall April 1, 2026 04:27
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 1, 2026 09:45
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 1, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/add-hook-to-ban-words (9a9fcd0) with main (b7333b0)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (7e7ecea) during the generation of this report, so b7333b0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@nathanjmcdougall nathanjmcdougall merged commit 17afa6b into main Apr 1, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/add-hook-to-ban-words branch April 1, 2026 10:41
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.

Add a hook to ban a list of words from the hooks directory

2 participants