'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':
('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),
[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")}
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)