[Python-checkins] cpython (3.5): Fix rstlint to also look for indented comments that should be directives.

georg.brandl python-checkins at python.org
Thu Feb 25 14:14:42 EST 2016


https://hg.python.org/cpython/rev/6281f080cb94
changeset:   100333:6281f080cb94
branch:      3.5
parent:      100331:d668b5595534
user:        Georg Brandl <georg at python.org>
date:        Thu Feb 25 20:14:10 2016 +0100
summary:
  Fix rstlint to also look for indented comments that should be directives.

files:
  Doc/tools/rstlint.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Doc/tools/rstlint.py b/Doc/tools/rstlint.py
--- a/Doc/tools/rstlint.py
+++ b/Doc/tools/rstlint.py
@@ -43,7 +43,7 @@
 ]
 
 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)?`($| )')
 leaked_markup_re = re.compile(r'[a-z]::\s|`|\.\.\s*\w+:')
 
@@ -83,7 +83,7 @@
     """Check for suspicious reST constructs."""
     inprod = False
     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'
         if '.. productionlist::' in line:
             inprod = True

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list