]> git.proxmox.com Git - mirror_ovs.git/blobdiff - utilities/checkpatch.py
python: Fix invalid escape sequences.
[mirror_ovs.git] / utilities / checkpatch.py
index 41676adab37510a88d1104b77f021cc3e65d02b1..d8bd34b1f19b134e81342314002c90b05a116142 100755 (executable)
@@ -518,38 +518,38 @@ checks = [
      'check': lambda x: trailing_whitespace_or_crlf(x),
      'print': lambda: print_warning("Line has trailing whitespace")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': lambda x: not if_and_for_whitespace_checks(x),
      'print': lambda: print_error("Improper whitespace around control block")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': lambda x: not if_and_for_end_with_bracket_check(x),
      'print': lambda: print_error("Inappropriate bracing around statement")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': lambda x: pointer_whitespace_check(x),
      'print':
      lambda: print_error("Inappropriate spacing in pointer declaration")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': lambda x: trailing_operator(x),
      'print':
      lambda: print_error("Line has '?' or ':' operator at end of line")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: has_comment(x),
      'check': lambda x: has_xxx_mark(x),
      'print': lambda: print_warning("Comment with 'xxx' marker")},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: has_comment(x),
      'check': lambda x: check_comment_spelling(x)},
 
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'check': lambda x: empty_return_with_brace(x),
      'interim_line': True,
      'print':
@@ -584,7 +584,7 @@ std_functions = [
         ('error', 'Use ovs_error() in place of error()'),
 ]
 checks += [
-    {'regex': '(\.c|\.h)(\.in)?$',
+    {'regex': r'(\.c|\.h)(\.in)?$',
      'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': regex_function_factory(function_name),
@@ -601,11 +601,11 @@ infix_operators = \
     [re.escape(op) for op in ['%', '<<', '>>', '<=', '>=', '==', '!=',
             '^', '|', '&&', '||', '?:', '=', '+=', '-=', '*=', '/=', '%=',
             '&=', '^=', '|=', '<<=', '>>=']] \
-    + ['[^<" ]<[^=" ]', '[^->" ]>[^=" ]', '[^ !()/"]\*[^/]', '[^ !&()"]&',
-       '[^" +(]\+[^"+;]', '[^" -(]-[^"->;]', '[^" <>=!^|+\-*/%&]=[^"=]',
+    + ['[^<" ]<[^=" ]', '[^->" ]>[^=" ]', r'[^ !()/"]\*[^/]', '[^ !&()"]&',
+       r'[^" +(]\+[^"+;]', '[^" -(]-[^"->;]', r'[^" <>=!^|+\-*/%&]=[^"=]',
        '[^* ]/[^* ]']
 checks += [
-    {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+    {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
      'prereq': lambda x: not is_comment_line(x),
      'check': regex_operator_factory(operator),
      'print': lambda: print_warning("Line lacks whitespace around operator")}
@@ -694,7 +694,7 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None):
     current_file = filename if checking_file else ''
     previous_file = ''
     seppatch = re.compile(r'^---([\w]*| \S+)$')
-    hunks = re.compile('^(---|\+\+\+) (\S+)')
+    hunks = re.compile(r'^(---|\+\+\+) (\S+)')
     hunk_differences = re.compile(
         r'^@@ ([0-9-+]+),([0-9-+]+) ([0-9-+]+),([0-9-+]+) @@')
     is_author = re.compile(r'^(Author|From): (.*)$', re.I | re.M | re.S)