Show More
@@ -51,6 +51,8 b' def compilere(pat, multiline=False):' | |||||
51 | return re.compile(pat) |
|
51 | return re.compile(pat) | |
52 |
|
52 | |||
53 | def repquote(m): |
|
53 | def repquote(m): | |
|
54 | # check "rules depending on implementation of repquote()" in each | |||
|
55 | # patterns (especially pypats), before changing this function | |||
54 | fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q'} |
|
56 | fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q'} | |
55 | def encodechr(i): |
|
57 | def encodechr(i): | |
56 | if i > 255: |
|
58 | if i > 255: | |
@@ -244,7 +246,6 b' pypats = [' | |||||
244 | (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), |
|
246 | (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), | |
245 | (r'\w\s=\s\s+\w', "gratuitous whitespace after ="), |
|
247 | (r'\w\s=\s\s+\w', "gratuitous whitespace after ="), | |
246 | (r'.{81}', "line too long"), |
|
248 | (r'.{81}', "line too long"), | |
247 | (r' x+[xpqo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), |
|
|||
248 | (r'[^\n]\Z', "no trailing newline"), |
|
249 | (r'[^\n]\Z', "no trailing newline"), | |
249 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
250 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | |
250 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', |
|
251 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', | |
@@ -311,8 +312,6 b' pypats = [' | |||||
311 | (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,', |
|
312 | (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,', | |
312 | 'legacy exception syntax; use "as" instead of ","'), |
|
313 | 'legacy exception syntax; use "as" instead of ","'), | |
313 | (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), |
|
314 | (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"), | |
314 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', |
|
|||
315 | "missing _() in ui message (use () to hide false-positives)"), |
|
|||
316 | (r'release\(.*wlock, .*lock\)', "wrong lock release order"), |
|
315 | (r'release\(.*wlock, .*lock\)', "wrong lock release order"), | |
317 | (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"), |
|
316 | (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"), | |
318 | (r'os\.path\.join\(.*, *(""|\'\')\)', |
|
317 | (r'os\.path\.join\(.*, *(""|\'\')\)', | |
@@ -325,9 +324,15 b' pypats = [' | |||||
325 | (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"), |
|
324 | (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"), | |
326 | (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"), |
|
325 | (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"), | |
327 | (r'\.next\(\)', "don't use .next(), use next(...)"), |
|
326 | (r'\.next\(\)', "don't use .next(), use next(...)"), | |
|
327 | ||||
|
328 | # rules depending on implementation of repquote() | |||
|
329 | (r' x+[xpqo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |||
|
330 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', | |||
|
331 | "missing _() in ui message (use () to hide false-positives)"), | |||
328 | ], |
|
332 | ], | |
329 | # warnings |
|
333 | # warnings | |
330 | [ |
|
334 | [ | |
|
335 | # rules depending on implementation of repquote() | |||
331 | (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), |
|
336 | (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"), | |
332 | ] |
|
337 | ] | |
333 | ] |
|
338 | ] | |
@@ -372,9 +377,13 b' cpats = [' | |||||
372 | (r'^\s*#import\b', "use only #include in standard C code"), |
|
377 | (r'^\s*#import\b', "use only #include in standard C code"), | |
373 | (r'strcpy\(', "don't use strcpy, use strlcpy or memcpy"), |
|
378 | (r'strcpy\(', "don't use strcpy, use strlcpy or memcpy"), | |
374 | (r'strcat\(', "don't use strcat"), |
|
379 | (r'strcat\(', "don't use strcat"), | |
|
380 | ||||
|
381 | # rules depending on implementation of repquote() | |||
375 | ], |
|
382 | ], | |
376 | # warnings |
|
383 | # warnings | |
377 |
[ |
|
384 | [ | |
|
385 | # rules depending on implementation of repquote() | |||
|
386 | ] | |||
378 | ] |
|
387 | ] | |
379 |
|
388 | |||
380 | cfilters = [ |
|
389 | cfilters = [ |
General Comments 0
You need to be logged in to leave comments.
Login now