Skip to content

Add prek hook to forbid double backticks in docstrings#1826

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/add-prek-hook-forbid-double-backticks
Closed

Add prek hook to forbid double backticks in docstrings#1826
Copilot wants to merge 4 commits intomainfrom
copilot/add-prek-hook-forbid-double-backticks

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

Agents and developers sometimes write RST-style double backtick markup ( foo ) in docstrings when single backticks should be used. This project uses Markdown-compatible docstrings, not RST.

New hook: hooks/check-docstring-substrings.py

General-purpose prek hook that parses Python files with ast, extracts only docstring nodes, and checks them for forbidden substrings. Accepts --forbidden args and file paths:

- id: check-docstring-substrings
  entry: uv run --frozen --offline hooks/check-docstring-substrings.py
  args: ["--forbidden", "``"]
  types: [python]

Multiple forbidden substrings supported via repeated --forbidden flags.

Existing violations fixed

Converted all ... `...` in docstrings across 12 files in src/ and hooks/. One triple-backtick code fence in imports.py converted to an indented code block to avoid false positives.

Copilot AI changed the title [WIP] Add prek hook to forbid double backticks in docstrings Add prek hook to forbid double backticks in docstrings Apr 6, 2026
Copilot AI requested a review from nathanjmcdougall April 6, 2026 19:28
@@ -119,13 +119,11 @@ def _get_child_dependencies(
`a` does not depend on anything, and `c` depends on `a` through `b`. Then the
function will return:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't good, I'll need to try a different design.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 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 6, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/add-prek-hook-forbid-double-backticks (9403b78) with main (7c45f33)

Open in CodSpeed

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 prek hook to forbid double backticks in docstrings

2 participants