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

Unified Diff: build/android/findbugs_diff.py

Issue 11273026: The findbugs_diff and lib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/findbugs_filter/findbugs_exclude.xml » ('j') | build/android/pylib/findbugs.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/findbugs_diff.py
diff --git a/build/android/findbugs_diff.py b/build/android/findbugs_diff.py
new file mode 100755
index 0000000000000000000000000000000000000000..d69615d985e66bb4baf9be64cee376fa6f64de00
--- /dev/null
+++ b/build/android/findbugs_diff.py
@@ -0,0 +1,82 @@
+#!/usr/bin/python
bulach 2012/10/25 08:30:06 nit: #!/usr/bin/env python
michaelbai 2012/10/25 21:13:26 Done.
+#
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Runs findbugs, and returns an error code if there are new warnings.
+This runs findbugs with an additional flag to exclude known bugs.
+To update the list of known bugs, do this:
+
+ findbugs_diff.py --rebaseline
+
+Note that this is separate from findbugs_exclude.xml. The "exclude" file has
+false positives that we do not plan to fix. The "known bugs" file has real
+bugs that we *do* plan to fix (but haven't done so yet).
+
+Other options
+ --only-analyze used to only analyze the class you are interested.
bulach 2012/10/25 08:30:06 nit: how about "filter" ? --only-analyze seems tha
michaelbai 2012/10/25 21:13:26 FindBugs calls exclude xml file as filter file, it
+ --release analyze the classes in out/Release directory.
bulach 2012/10/25 08:30:06 nit: how about buildtype? then it can have as defa
michaelbai 2012/10/25 21:13:26 I'd like use the --release-build, since there are
+ --findbugs-args used to passin other findbugs's options.
+
+Run
+ CHROM_SRC/third_party/findbugs/bin/findbugs -textui for details.
bulach 2012/10/25 08:30:06 nit: $CHROME_SRC
michaelbai 2012/10/25 21:13:26 Done.
+
+"""
+
+import optparse
+import os
+import sys
+
+from pylib import findbugs
+
bulach 2012/10/25 08:30:06 nit: need an extra \n
michaelbai 2012/10/25 21:13:26 Done.
+def main(argv):
+ parser = optparse.OptionParser()
+ parser.add_option('-r',
+ '--rebaseline',
+ action='store_true',
+ default=False,
bulach 2012/10/25 08:30:06 nit: "default=False" can be removed here and 52 an
michaelbai 2012/10/25 21:13:26 Done.
+ dest='rebaseline',
+ help='Rebaseline known findbugs issues.')
+
+ parser.add_option('-o',
+ '--only-analyze',
+ action='store',
+ default=None,
+ dest='only_analyze',
+ help='Only analyze the given classes and packages.')
+
+ parser.add_option('-l',
+ '--release',
+ action='store_true',
+ default=False,
+ dest='release_version',
+ help='Whether check release version.')
+
+ parser.add_option('-f',
+ '--findbug-args',
+ action='store',
+ default=None,
+ dest='findbug_args',
+ help='Additoinal findbug arguments.')
bulach 2012/10/25 08:30:06 nit: Additional
michaelbai 2012/10/25 21:13:26 Done.
+
+ options, _ = parser.parse_args()
+
+ chrome_src = os.getenv('CHROME_SRC')
+
+ known_bugs = os.path.join(chrome_src, 'build', 'android', 'findbugs_filter',
bulach 2012/10/25 08:30:06 nit: maybe have a "baseline_dir" as option? that w
michaelbai 2012/10/25 21:13:26 I see your point, you want to use the same script
+ 'findbugs_known_bugs.txt')
+ exclude_filter = os.path.join(chrome_src, 'build', 'android',
+ 'findbugs_filter', 'findbugs_exclude.xml')
+
+ only_analyze = options.only_analyze
+ if not only_analyze:
+ only_analyze = 'org.chromium.-'
+
+ return findbugs.Run(exclude_filter, known_bugs, only_analyze,
+ None, options.rebaseline, options.findbug_args,
+ options.release_version)
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
« no previous file with comments | « no previous file | build/android/findbugs_filter/findbugs_exclude.xml » ('j') | build/android/pylib/findbugs.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698