mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Fix rstlint to also look for indented comments that should be directives.
This commit is contained in:
parent
eae3336e42
commit
2305b3cde3
1 changed files with 2 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ directives = [
|
||||||
]
|
]
|
||||||
|
|
||||||
all_directives = '(' + '|'.join(directives) + ')'
|
all_directives = '(' + '|'.join(directives) + ')'
|
||||||
seems_directive_re = re.compile(r'\.\. %s([^a-z:]|:(?!:))' % all_directives)
|
seems_directive_re = re.compile(r'(?<!\.)\.\. %s([^a-z:]|:(?!:))' % all_directives)
|
||||||
default_role_re = re.compile(r'(^| )`\w([^`]*?\w)?`($| )')
|
default_role_re = re.compile(r'(^| )`\w([^`]*?\w)?`($| )')
|
||||||
leaked_markup_re = re.compile(r'[a-z]::\s|`|\.\.\s*\w+:')
|
leaked_markup_re = re.compile(r'[a-z]::\s|`|\.\.\s*\w+:')
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ def check_suspicious_constructs(fn, lines):
|
||||||
"""Check for suspicious reST constructs."""
|
"""Check for suspicious reST constructs."""
|
||||||
inprod = False
|
inprod = False
|
||||||
for lno, line in enumerate(lines):
|
for lno, line in enumerate(lines):
|
||||||
if seems_directive_re.match(line):
|
if seems_directive_re.search(line):
|
||||||
yield lno+1, 'comment seems to be intended as a directive'
|
yield lno+1, 'comment seems to be intended as a directive'
|
||||||
if '.. productionlist::' in line:
|
if '.. productionlist::' in line:
|
||||||
inprod = True
|
inprod = True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue