Commit d1c69c21 authored by Raymond Hettinger's avatar Raymond Hettinger

Added doubled word warnings.

parent 9efcbced
...@@ -1740,7 +1740,7 @@ in a negative index); this is the customary handling of negative ...@@ -1740,7 +1740,7 @@ in a negative index); this is the customary handling of negative
indexes by the built-in sequence types, and the \method{__*item__()} indexes by the built-in sequence types, and the \method{__*item__()}
methods are expected to do this as well. However, since they should methods are expected to do this as well. However, since they should
already be doing that, negative indexes cannot be passed in; they must already be doing that, negative indexes cannot be passed in; they must
be be constrained to the bounds of the sequence before being passed to be constrained to the bounds of the sequence before being passed to
the \method{__*item__()} methods. the \method{__*item__()} methods.
Calling \code{max(0, i)} conveniently returns the proper value. Calling \code{max(0, i)} conveniently returns the proper value.
......
...@@ -55,6 +55,8 @@ Library ...@@ -55,6 +55,8 @@ Library
Tools/Demos Tools/Demos
----------- -----------
- texcheck.py now detects double word errors.
- md5sum.py mistakenly opened input files in text mode by default, a - md5sum.py mistakenly opened input files in text mode by default, a
silent and dangerous change from previous releases. It once again silent and dangerous change from previous releases. It once again
opens input files in binary mode by default. The -t and -b flags opens input files in binary mode by default. The -t and -b flags
......
...@@ -98,6 +98,7 @@ def checkit(source, opts, morecmds=[]): ...@@ -98,6 +98,7 @@ def checkit(source, opts, morecmds=[]):
delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
braces = re.compile(r'({)|(})') braces = re.compile(r'({)|(})')
doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
openers = [] # Stack of pending open delimiters openers = [] # Stack of pending open delimiters
bracestack = [] # Stack of pending open braces bracestack = [] # Stack of pending open braces
...@@ -175,6 +176,8 @@ def checkit(source, opts, morecmds=[]): ...@@ -175,6 +176,8 @@ def checkit(source, opts, morecmds=[]):
if 'e.g.' in line or 'i.e.' in line: 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,) 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 lastline = lineno
for lineno, symbol in openers: for lineno, symbol in openers:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment