Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rst-directive-space check #134

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
types: [rst]
- id: rst-directive-colons
name: rst directives end with two colons
description: 'Detect mistake of rst directive not ending with double colon'
entry: '^\s*\.\. [a-z]+:$'
description: 'Detect mistake of rst directive not ending with double colon or space before the double colon'
entry: '^\s*\.\. [a-z]+(| | :):$'
language: pygrep
types: [rst]
- id: rst-inline-touching-normal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ For example, a hook which targets python will be called `python-...`.
- **`python-no-log-warn`**: A quick check for the deprecated `.warn()` method of python loggers
- **`python-use-type-annotations`**: Enforce that python3.6+ type annotations are used instead of type comments
- **`rst-backticks`**: Detect common mistake of using single backticks when writing rst
- **`rst-directive-colons`**: Detect mistake of rst directive not ending with double colon
- **`rst-directive-colons`**: Detect mistake of rst directive not ending with double colon or space before the double colon
- **`rst-inline-touching-normal`**: Detect mistake of inline code touching normal text in rst
- **`text-unicode-replacement-char`**: Forbid files which have a UTF-8 Unicode replacement character
4 changes: 4 additions & 0 deletions tests/hooks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ def test_text_unicode_replacement_char_negative(s):
(
' .. warning:',
'.. warning:',
' .. warning ::',
'.. warning ::',
' .. warning :',
'.. warning :',
),
)
def test_rst_directive_colons_positive(s):
Expand Down