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

Conversation

oscargus
Copy link
Contributor

Another reasonably common mistake, e.g. matplotlib/matplotlib#24927 is to put a space before the double colon.

Ideally one should check for the combination of space and single colon, but not clear if it is better to merge this check with a more complicated regex for test-directive-colons or modify this to check for both (or keep it as is).

(Also, this will not catch matplotlib/matplotlib#24927 as it is in a py and a c++-file, but for consistency with the other rst-tests...)

@oscargus oscargus force-pushed the rst-space branch 2 times, most recently from 240bf0b to 83f55a4 Compare January 10, 2023 11:16
@oscargus oscargus changed the title Add rst-directive-space check Add rst-directive-space check Jan 10, 2023
Comment on lines 68 to 67
- id: rst-directive-space
name: rst directives space before two colons
description: 'Detect mistake of additional space in rst directive'
entry: '^\s*\.\. [a-z]+ ::$'
language: pygrep
types: [rst]
Copy link
Member

Choose a reason for hiding this comment

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

this can probably get bundled in with the other rst check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK! Done!

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit 3a028dc into pre-commit:main Jan 12, 2023
@oscargus oscargus deleted the rst-space branch January 14, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants