Skip to content

Commit 3a028dc

Browse files
authored
Merge pull request #134 from oscargus/rst-space
Add `rst-directive-space` check
2 parents 72bd2c9 + 8b6cedc commit 3a028dc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.pre-commit-hooks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
types: [rst]
6262
- id: rst-directive-colons
6363
name: rst directives end with two colons
64-
description: 'Detect mistake of rst directive not ending with double colon'
65-
entry: '^\s*\.\. [a-z]+:$'
64+
description: 'Detect mistake of rst directive not ending with double colon or space before the double colon'
65+
entry: '^\s*\.\. [a-z]+(| | :):$'
6666
language: pygrep
6767
types: [rst]
6868
- id: rst-inline-touching-normal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ For example, a hook which targets python will be called `python-...`.
3131
- **`python-no-log-warn`**: A quick check for the deprecated `.warn()` method of python loggers
3232
- **`python-use-type-annotations`**: Enforce that python3.6+ type annotations are used instead of type comments
3333
- **`rst-backticks`**: Detect common mistake of using single backticks when writing rst
34-
- **`rst-directive-colons`**: Detect mistake of rst directive not ending with double colon
34+
- **`rst-directive-colons`**: Detect mistake of rst directive not ending with double colon or space before the double colon
3535
- **`rst-inline-touching-normal`**: Detect mistake of inline code touching normal text in rst
3636
- **`text-unicode-replacement-char`**: Forbid files which have a UTF-8 Unicode replacement character

tests/hooks_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ def test_text_unicode_replacement_char_negative(s):
249249
(
250250
' .. warning:',
251251
'.. warning:',
252+
' .. warning ::',
253+
'.. warning ::',
254+
' .. warning :',
255+
'.. warning :',
252256
),
253257
)
254258
def test_rst_directive_colons_positive(s):

0 commit comments

Comments
 (0)