rename infer.py to analyze.py

Summary: public
This should avoid confusion between the toplevel "infer" python script and
inferlib/infer.py.

Reviewed By: jeremydubreil

Differential Revision: D2637087

fb-gh-sync-id: 82ce2a4
master
Jules Villard 9 years ago committed by facebook-github-bot-7
parent 5f57d199f3
commit e03b36338b

@ -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',

@ -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

@ -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)

@ -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

@ -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:

@ -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):

@ -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

Loading…
Cancel
Save