diff --git a/infer/lib/python/BuckAnalyze b/infer/lib/python/BuckAnalyze index f01be97d1..2f67bfda0 100755 --- a/infer/lib/python/BuckAnalyze +++ b/infer/lib/python/BuckAnalyze @@ -30,7 +30,7 @@ import time import traceback import zipfile -from inferlib import infer, utils +from inferlib import analyze, utils ANALYSIS_SUMMARY_OUTPUT = 'analysis_summary.txt' @@ -448,7 +448,7 @@ def collect_results(args, start_time): report.flush() print('\n') - infer.print_errors(csv_report, bugs_out) + analyze.print_errors(csv_report, bugs_out) stats['int']['total_time'] = int(round(utils.elapsed_time(start_time))) @@ -489,7 +489,7 @@ def cleanup(temp_files): if __name__ == '__main__': - parser = argparse.ArgumentParser(parents=[infer.base_parser]) + parser = argparse.ArgumentParser(parents=[analyze.base_parser]) parser.add_argument('--verbose', action='store_true', help='Print buck compilation steps') parser.add_argument('--no-cache', action='store_true', diff --git a/infer/lib/python/infer b/infer/lib/python/infer index 4c7bce4b4..c0a03fcc2 100755 --- a/infer/lib/python/infer +++ b/infer/lib/python/infer @@ -9,7 +9,7 @@ import platform import sys import inferlib -from inferlib import infer, utils +from inferlib import analyze, utils CAPTURE_PACKAGE = 'capture' @@ -73,7 +73,7 @@ def split_args_to_parse(): def create_argparser(parents=[]): parser = argparse.ArgumentParser( - parents=[infer.infer_parser] + parents, + parents=[analyze.infer_parser] + parents, add_help=False, formatter_class=argparse.RawDescriptionHelpFormatter, ) @@ -125,15 +125,15 @@ def main(): if (imported_module and not args.incremental and capture_module_name != 'analyze'): - infer.remove_infer_out(args.infer_out) + analyze.remove_infer_out(args.infer_out) - infer.create_results_dir(args.infer_out) + analyze.create_results_dir(args.infer_out) configure_logging(args.infer_out, args.log_to_stderr) logging.info('Running command %s', ' '.join(sys.argv)) logging.info('Path to infer script %s (%s)', __file__, os.path.realpath(__file__)) - logging.info(infer.get_infer_version()) + logging.info(analyze.get_infer_version()) logging.info('Platform: %s', platform.platform()) logging.info('PATH=%s', os.getenv('PATH')) logging.info('SHELL=%s', os.getenv('SHELL')) @@ -160,7 +160,7 @@ def main(): if not os.path.exists(os.path.join(args.infer_out, 'captured')): print('There was nothing to analyze, exiting') exit(os.EX_USAGE) - analysis = infer.Infer(args, []) + analysis = analyze.Infer(args, []) analysis.analyze_and_report() analysis.save_stats() @@ -171,7 +171,7 @@ def main(): with open(bugs_filename) as bugs_file: bugs = json.load(bugs_file) if len(bugs) > 0: - sys.exit(infer.BUG_FOUND_ERROR_CODE) + sys.exit(analyze.BUG_FOUND_ERROR_CODE) except OSError: pass diff --git a/infer/lib/python/inferTraceBugs b/infer/lib/python/inferTraceBugs index b156d4b1f..e6d4e01a9 100755 --- a/infer/lib/python/inferTraceBugs +++ b/infer/lib/python/inferTraceBugs @@ -20,7 +20,7 @@ import shutil import subprocess import sys -from inferlib import infer, utils +from inferlib import analyze, utils HTML_REPORT_DIR = 'report.html' TRACES_REPORT_DIR = 'traces' @@ -345,10 +345,10 @@ def html_list_of_bugs(args, remote_source_template, selector): def generate_html_report(args, reports): html_dir = os.path.join(args.infer_out, HTML_REPORT_DIR) shutil.rmtree(html_dir, True) - infer.mkdir_if_not_exists(html_dir) + analyze.mkdir_if_not_exists(html_dir) traces_dir = os.path.join(html_dir, TRACES_REPORT_DIR) - infer.mkdir_if_not_exists(traces_dir) + analyze.mkdir_if_not_exists(traces_dir) sel = Selector(args, reports) diff --git a/infer/lib/python/inferlib/infer.py b/infer/lib/python/inferlib/analyze.py similarity index 100% rename from infer/lib/python/inferlib/infer.py rename to infer/lib/python/inferlib/analyze.py diff --git a/infer/lib/python/inferlib/capture/buck.py b/infer/lib/python/inferlib/capture/buck.py index 5b870e06e..08be1803e 100644 --- a/infer/lib/python/inferlib/capture/buck.py +++ b/infer/lib/python/inferlib/capture/buck.py @@ -139,7 +139,7 @@ class BuckAnalyzer: utils.merge_json_reports( result_files, merged_results_path) - # TODO: adapt infer.print_errors to support json and print on screen + # TODO: adapt analyze.print_errors to support json and print on screen print('Results saved in {results_path}'.format( results_path=merged_results_path)) return os.EX_OK diff --git a/infer/lib/python/inferlib/capture/javac.py b/infer/lib/python/inferlib/capture/javac.py index 2c52bf00f..73ac57260 100644 --- a/infer/lib/python/inferlib/capture/javac.py +++ b/infer/lib/python/inferlib/capture/javac.py @@ -10,7 +10,7 @@ import subprocess import traceback import util -from inferlib import infer +from inferlib import analyze MODULE_NAME = __name__ MODULE_DESCRIPTION = '''Run analysis of code built with a command like: @@ -30,7 +30,7 @@ create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME) class JavacCapture: def __init__(self, args, cmd): - self.analysis = infer.Infer(args, cmd[1:]) + self.analysis = analyze.Infer(args, cmd[1:]) def capture(self): try: diff --git a/infer/lib/python/inferlib/capture/util.py b/infer/lib/python/inferlib/capture/util.py index 281e08b2a..6fd2a6ed0 100644 --- a/infer/lib/python/inferlib/capture/util.py +++ b/infer/lib/python/inferlib/capture/util.py @@ -13,7 +13,7 @@ import logging import subprocess import traceback -from inferlib import infer +from inferlib import analyze def create_infer_command(args, javac_arguments): @@ -22,8 +22,8 @@ def create_infer_command(args, javac_arguments): infer_args.append('--debug') infer_args += ['--analyzer', 'capture'] - return infer.Infer(infer.infer_parser.parse_args(infer_args), - infer.get_javac_args(['javac'] + javac_arguments)) + return analyze.Infer(analyze.infer_parser.parse_args(infer_args), + analyze.get_javac_args(['javac'] + javac_arguments)) def get_build_output(build_cmd): diff --git a/infer/models/Makefile b/infer/models/Makefile index e7961f450..e0fadb27e 100644 --- a/infer/models/Makefile +++ b/infer/models/Makefile @@ -13,7 +13,7 @@ LIB_SPECS = $(LIBDIR)/specs INFERANALYZE = $(BINDIR)/InferAnalyze INFERCLANG = $(BINDIR)/InferClang INFERJAVA = $(BINDIR)/InferJava -JAVA_SCRIPTS = $(addprefix $(PYTHONLIBDIR)/, jwlib.py infer.py) \ +JAVA_SCRIPTS = $(addprefix $(PYTHONLIBDIR)/, jwlib.py analyze.py) \ $(BINDIR)/infer CLANG_SCRIPTS = $(addprefix $(CAPTURELIBDIR)/, make.py) \ $(BINDIR)/infer