Skip to content

Commit

Permalink
Add rst-directive-space check
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Jan 12, 2023
1 parent 72bd2c9 commit 5bdcef8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit 5bdcef8

Please sign in to comment.