contrib/check-code.py
changeset 34384 b52f22d9afa5
parent 34082 ba6e14f9a2d8
child 34429 b332c01247d8
equal deleted inserted replaced
34383:ab687e06fe02 34384:b52f22d9afa5
   255     (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
   255     (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
   256     (r'(\w|\)),\w', "missing whitespace after ,"),
   256     (r'(\w|\)),\w', "missing whitespace after ,"),
   257     (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
   257     (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
   258     (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
   258     (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
   259     (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
   259     (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
       
   260     ((
       
   261         # a line ending with a colon, potentially with trailing comments
       
   262         r':([ \t]*#[^\n]*)?\n'
       
   263         # one that is not a pass and not only a comment
       
   264         r'(?P<indent>[ \t]+)[^#][^\n]+\n'
       
   265         # more lines at the same indent level
       
   266         r'((?P=indent)[^\n]+\n)*'
       
   267         # a pass at the same indent level, which is bogus
       
   268         r'(?P=indent)pass[ \t\n#]'
       
   269       ), 'omit superfluous pass'),
   260     (r'.{81}', "line too long"),
   270     (r'.{81}', "line too long"),
   261     (r'[^\n]\Z', "no trailing newline"),
   271     (r'[^\n]\Z', "no trailing newline"),
   262     (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
   272     (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
   263 #    (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
   273 #    (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
   264 #     "don't use underbars in identifiers"),
   274 #     "don't use underbars in identifiers"),