OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Runs findbugs, and returns an error code if there are new warnings. | 7 """Runs findbugs, and returns an error code if there are new warnings. |
8 This runs findbugs with an additional flag to exclude known bugs. | 8 This runs findbugs with an additional flag to exclude known bugs. |
9 To update the list of known bugs, do this: | 9 To update the list of known bugs, do this: |
10 | 10 |
11 findbugs_diff.py --rebaseline | 11 findbugs_diff.py --rebaseline |
12 | 12 |
13 Note that this is separate from findbugs_exclude.xml. The "exclude" file has | 13 Note that this is separate from findbugs_exclude.xml. The "exclude" file has |
14 false positives that we do not plan to fix. The "known bugs" file has real | 14 false positives that we do not plan to fix. The "known bugs" file has real |
15 bugs that we *do* plan to fix (but haven't done so yet). | 15 bugs that we *do* plan to fix (but haven't done so yet). |
16 | 16 |
17 Other options | 17 Other options |
18 --only-analyze used to only analyze the class you are interested. | 18 --only-analyze used to only analyze the class you are interested. |
19 --relase-build analyze the classes in out/Release directory. | 19 --relase-build analyze the classes in out/Release directory. |
20 --findbugs-args used to passin other findbugs's options. | 20 --findbugs-args used to passin other findbugs's options. |
21 | 21 |
22 Run | 22 Run |
23 $CHROM_SRC/third_party/findbugs/bin/findbugs -textui for details. | 23 $CHROM_SRC/third_party/findbugs/bin/findbugs -textui for details. |
24 | 24 |
25 """ | 25 """ |
26 | 26 |
27 import optparse | |
28 import os | 27 import os |
29 import sys | 28 import sys |
30 | 29 |
31 from pylib import constants | 30 from pylib import constants |
32 from pylib.utils import findbugs | 31 from pylib.utils import findbugs |
33 | 32 |
34 | 33 |
35 def main(argv): | 34 def main(): |
36 parser = findbugs.GetCommonParser() | 35 parser = findbugs.GetCommonParser() |
37 | 36 |
38 options, _ = parser.parse_args() | 37 options, _ = parser.parse_args() |
39 | 38 |
40 if not options.base_dir: | 39 if not options.base_dir: |
41 options.base_dir = os.path.join(constants.DIR_SOURCE_ROOT, 'build', | 40 options.base_dir = os.path.join(constants.DIR_SOURCE_ROOT, 'build', |
42 'android', 'findbugs_filter') | 41 'android', 'findbugs_filter') |
43 if not options.only_analyze: | 42 if not options.only_analyze: |
44 options.only_analyze = 'org.chromium.-' | 43 options.only_analyze = 'org.chromium.-' |
45 | 44 |
46 return findbugs.Run(options) | 45 return findbugs.Run(options) |
47 | 46 |
48 | 47 |
49 if __name__ == '__main__': | 48 if __name__ == '__main__': |
50 sys.exit(main(sys.argv)) | 49 sys.exit(main()) |
OLD | NEW |