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

Side by Side Diff: build/android/pylib/utils/findbugs.py

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import optparse 5 import optparse
6 import os 6 import os
7 import re 7 import re
8 import shlex 8 import shlex
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 14 matching lines...) Expand all
25 print '-' * 80 25 print '-' * 80
26 print 26 print
27 27
28 28
29 def _StripLineNumbers(current_warnings): 29 def _StripLineNumbers(current_warnings):
30 re_line = r':\[line.*?\]$' 30 re_line = r':\[line.*?\]$'
31 return [re.sub(re_line, '', x) for x in current_warnings] 31 return [re.sub(re_line, '', x) for x in current_warnings]
32 32
33 33
34 def _DiffKnownWarnings(current_warnings_set, known_bugs_file): 34 def _DiffKnownWarnings(current_warnings_set, known_bugs_file):
35 with open(known_bugs_file, 'r') as known_bugs: 35 if os.path.exists(known_bugs_file):
36 known_bugs_set = set(known_bugs.read().splitlines()) 36 with open(known_bugs_file, 'r') as known_bugs:
37 known_bugs_set = set(known_bugs.read().splitlines())
38 else:
39 known_bugs_set = set()
37 40
38 new_warnings = current_warnings_set - known_bugs_set 41 new_warnings = current_warnings_set - known_bugs_set
39 _PrintMessage(sorted(new_warnings), 'New', 'Please fix, or perhaps add to', 42 _PrintMessage(sorted(new_warnings), 'New', 'Please fix, or perhaps add to',
40 known_bugs_file) 43 known_bugs_file)
41 44
42 obsolete_warnings = known_bugs_set - current_warnings_set 45 obsolete_warnings = known_bugs_set - current_warnings_set
43 _PrintMessage(sorted(obsolete_warnings), 'Obsolete', 'Please remove from', 46 _PrintMessage(sorted(obsolete_warnings), 'Obsolete', 'Please remove from',
44 known_bugs_file) 47 known_bugs_file)
45 48
46 count = len(new_warnings) + len(obsolete_warnings) 49 count = len(new_warnings) + len(obsolete_warnings)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 246
244 def main(): 247 def main():
245 parser = GetCommonParser() 248 parser = GetCommonParser()
246 options, _ = parser.parse_args() 249 options, _ = parser.parse_args()
247 250
248 return Run(options) 251 return Run(options)
249 252
250 253
251 if __name__ == '__main__': 254 if __name__ == '__main__':
252 sys.exit(main()) 255 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698