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