Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python.py

Issue 2305143003: webkitpy: Make all regex strings use raw string literals. (Closed)
Patch Set: Make all regex strings raw strings. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 1. Redistributions of source code must retain the above copyright 6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright 8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the 9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution. 10 # documentation and/or other materials provided with the distribution.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 FALSE_POSITIVES = [ 95 FALSE_POSITIVES = [
96 # possibly http://www.logilab.org/ticket/98613 ? 96 # possibly http://www.logilab.org/ticket/98613 ?
97 "Instance of 'Popen' has no 'poll' member", 97 "Instance of 'Popen' has no 'poll' member",
98 "Instance of 'Popen' has no 'returncode' member", 98 "Instance of 'Popen' has no 'returncode' member",
99 "Instance of 'Popen' has no 'stdin' member", 99 "Instance of 'Popen' has no 'stdin' member",
100 "Instance of 'Popen' has no 'stdout' member", 100 "Instance of 'Popen' has no 'stdout' member",
101 "Instance of 'Popen' has no 'stderr' member", 101 "Instance of 'Popen' has no 'stderr' member",
102 "Instance of 'Popen' has no 'wait' member", 102 "Instance of 'Popen' has no 'wait' member",
103 ] 103 ]
104 104
105 lint_regex = re.compile('([^:]+):([^:]+): \[([^]]+)\] (.*)') 105 lint_regex = re.compile(r'([^:]+):([^:]+): \[([^]]+)\] (.*)')
106 errors = [] 106 errors = []
107 for line in output.splitlines(): 107 for line in output.splitlines():
108 if any(msg in line for msg in FALSE_POSITIVES): 108 if any(msg in line for msg in FALSE_POSITIVES):
109 continue 109 continue
110 110
111 match_obj = lint_regex.match(line) 111 match_obj = lint_regex.match(line)
112 if not match_obj: 112 if not match_obj:
113 continue 113 continue
114 114
115 line_number = int(match_obj.group(2)) 115 line_number = int(match_obj.group(2))
116 category_and_method = match_obj.group(3).split(', ') 116 category_and_method = match_obj.group(3).split(', ')
117 category = 'pylint/' + (category_and_method[0]) 117 category = 'pylint/' + (category_and_method[0])
118 if len(category_and_method) > 1: 118 if len(category_and_method) > 1:
119 message = '[%s] %s' % (category_and_method[1], match_obj.group(4 )) 119 message = '[%s] %s' % (category_and_method[1], match_obj.group(4 ))
120 else: 120 else:
121 message = match_obj.group(4) 121 message = match_obj.group(4)
122 errors.append((line_number, category, message)) 122 errors.append((line_number, category, message))
123 return errors 123 return errors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698