Title: Add prek hook to forbid banned comment keywords (pragma, type:) · Issue #1820 · usethis-python/usethis-python · GitHub
Open Graph Title: Add prek hook to forbid banned comment keywords (pragma, type:) · Issue #1820 · usethis-python/usethis-python
X Title: Add prek hook to forbid banned comment keywords (pragma, type:) · Issue #1820 · usethis-python/usethis-python
Description: Problem Agents (and developers) sometimes add comment annotations that this project doesn't want: # pragma: no cover — coverage exclusion comments should not be used; instead write tests to cover the code, or remove unreachable branches ...
Open Graph Description: Problem Agents (and developers) sometimes add comment annotations that this project doesn't want: # pragma: no cover — coverage exclusion comments should not be used; instead write tests to cover t...
X Description: Problem Agents (and developers) sometimes add comment annotations that this project doesn't want: # pragma: no cover — coverage exclusion comments should not be used; instead write tests to cov...
Opengraph URL: https://github.com/usethis-python/usethis-python/issues/1820
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add prek hook to forbid banned comment keywords (pragma, type:)","articleBody":"## Problem\n\nAgents (and developers) sometimes add comment annotations that this project doesn't want:\n\n1. `# pragma: no cover` — coverage exclusion comments should not be used; instead write tests to cover the code, or remove unreachable branches\n2. `# type: ignore[...]` — mypy-style type suppression comments; this project uses basedpyright, and any needed type suppressions should use `# pyright: ignore[...]` instead\n\nThese were added in PR #1795 (`src/usethis/_file/setup_cfg/deps.py`) and caught in code review.\n\n## Solution\n\nAdd a prek (bespoke) hook that scans Python files and fails if any of these banned keywords are found in comments:\n- `pragma:` (catches `# pragma: no cover` and similar)\n- `type: ignore` (catches `# type: ignore[...]`)\n\nThe hook should be provided via CLI, scanning all Python files in `src/` and `tests/`, and report the file/line/column of any violations.\n\n## Implementation Notes\n\n- This should be a bespoke prek hook (see `.agents/skills/usethis-prek-hook-bespoke-create/SKILL.md`)\n- The hook should accept a list of banned patterns via CLI so it's reusable\n- Should report clear error messages like: `src/foo.py:42: Found banned comment keyword 'pragma:'`","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2026-04-06T03:52:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1820/usethis-python/issues/1820"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:392efae1-5ed8-bc86-5aef-83beab5f43ac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C16E:1A0CEA:1EF2E81:2B9048E:6A4CD053 |
| html-safe-nonce | 15f2dfc75c16745d876b2d2402297e6805736cdecba3570e424f77c24b09c978 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTZFOjFBMENFQToxRUYyRTgxOjJCOTA0OEU6NkE0Q0QwNTMiLCJ2aXNpdG9yX2lkIjoiNDQzNjYwNTI4MTg2NjkyODIxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9a0a7bfd2562459c22c17eeecbb6f5510eddb8a8d7b9665e621a577624d2d2ab |
| hovercard-subject-tag | issue:4209420371 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/usethis-python/usethis-python/1820/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4f038f64922e6d98c7437aa3d0b504732b6c7cfb7dc3450aef709ac96a156d95/usethis-python/usethis-python/issues/1820 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4f038f64922e6d98c7437aa3d0b504732b6c7cfb7dc3450aef709ac96a156d95/usethis-python/usethis-python/issues/1820 |
| og:image:alt | Problem Agents (and developers) sometimes add comment annotations that this project doesn't want: # pragma: no cover — coverage exclusion comments should not be used; instead write tests to cover t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nathanjmcdougall |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee8a9d18044a05fe2d57b9ae797da38c8be34effb03f015f7c42e94770d28a1b |
| turbo-cache-control | no-preview |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f84814acc6f036583fd43463f5847a846243d2a4 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width