check-code: allow old style class with special comments
authorJun Wu <quark@fb.com>
Wed, 24 Feb 2016 18:42:14 +0000
changeset 28219 97fe88806f6f
parent 28218 41dcd7545266
child 28223 0a853dc9b306
check-code: allow old style class with special comments The following chgserver change will use an old style class to comply with SocketServer's code style. This patch made it possible to pass check-code.
contrib/check-code.py
--- a/contrib/check-code.py	Wed Feb 24 15:55:44 2016 -0600
+++ b/contrib/check-code.py	Wed Feb 24 18:42:14 2016 +0000
@@ -245,9 +245,11 @@
      "don't use camelcase in identifiers"),
     (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
      "linebreak after :"),
-    (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
+    (r'class\s[^( \n]+:', "old-style class, use class foo(object)",
+     r'#.*old-style'),
     (r'class\s[^( \n]+\(\):',
-     "class foo() creates old style object, use class foo(object)"),
+     "class foo() creates old style object, use class foo(object)",
+     r'#.*old-style'),
     (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist
                             if k not in ('print', 'exec')),
      "Python keyword is not a function"),