mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Added doubled word warnings.
This commit is contained in:
parent
999b57c872
commit
e41d4c8ec9
3 changed files with 6 additions and 1 deletions
|
@ -98,6 +98,7 @@ def checkit(source, opts, morecmds=[]):
|
|||
|
||||
delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
|
||||
braces = re.compile(r'({)|(})')
|
||||
doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
|
||||
|
||||
openers = [] # Stack of pending open delimiters
|
||||
bracestack = [] # Stack of pending open braces
|
||||
|
@ -175,6 +176,8 @@ def checkit(source, opts, morecmds=[]):
|
|||
if 'e.g.' in line or 'i.e.' in line:
|
||||
print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,)
|
||||
|
||||
for dw in doubledwords.findall(line):
|
||||
print r'Doubled word warning. "%s" on line %d' % (dw, lineno)
|
||||
|
||||
lastline = lineno
|
||||
for lineno, symbol in openers:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue