Don't add buckets to error message by default

Summary:
@public
Currently InferAnalyze always adds bucket to the message. Later, python code
strips it, but not everywhere. Changes:
1. Since it's easy to not write bucket in ocaml, stop writing them by default.
2. Add option to print them to InferAnalyze and pass it if infer is in debug mode.

Test Plan:
1. Run on openssl, confirm that no bucket info is written to stdout and csv
2. Run on small example in debug mode and see buckets on stdout
master
Andrzej Kotulski 10 years ago
parent e3e9221a9d
commit f99f650b07

@ -308,7 +308,7 @@ def print_errors(csv_report, bugs_out):
kind = row[utils.CSV_INDEX_KIND] kind = row[utils.CSV_INDEX_KIND]
line = row[utils.CSV_INDEX_LINE] line = row[utils.CSV_INDEX_LINE]
error_type = row[utils.CSV_INDEX_TYPE] error_type = row[utils.CSV_INDEX_TYPE]
msg = utils.remove_bucket(row[utils.CSV_INDEX_QUALIFIER]) msg = row[utils.CSV_INDEX_QUALIFIER]
print_and_write( print_and_write(
file_out, file_out,
'{0}:{1}: {2}: {3}\n {4}\n'.format( '{0}:{1}: {2}: {3}\n {4}\n'.format(
@ -459,6 +459,7 @@ class Infer:
'-dotty', '-dotty',
'-print_types', '-print_types',
'-trace_error', '-trace_error',
'-print_buckets',
# '-notest', # '-notest',
] ]

@ -101,12 +101,6 @@ def error(msg):
print(msg, file=sys.stderr) print(msg, file=sys.stderr)
def remove_bucket(bug_message):
""" Remove anything from the beginning if the message that
looks like a bucket """
return re.sub(r'(^\[[a-zA-Z0-9]*\])', '', bug_message, 1)
def get_cmd_in_bin_dir(binary_name): def get_cmd_in_bin_dir(binary_name):
# this relies on the fact that utils.py is located in infer/bin # this relies on the fact that utils.py is located in infer/bin
return os.path.join( return os.path.join(

@ -318,10 +318,10 @@ let optimistic_cast = ref false
let filter_buckets = ref false let filter_buckets = ref false
(** if true, show buckets in textual description of errors *) (** if true, show buckets in textual description of errors *)
let show_buckets = ref true let show_buckets = ref false
(** if true, show memory leak buckets in textual description of errors *) (** if true, show memory leak buckets in textual description of errors *)
let show_ml_buckets = ref true let show_ml_buckets = ref false
(** if true, print cfg nodes in the dot file that are not defined in that file *) (** if true, print cfg nodes in the dot file that are not defined in that file *)
let dotty_cfg_libs = ref true let dotty_cfg_libs = ref true

@ -172,7 +172,9 @@ let arg_desc =
"-tracing", Arg.Unit (fun () -> Config.report_runtime_exceptions := true), None, "-tracing", Arg.Unit (fun () -> Config.report_runtime_exceptions := true), None,
"Report error traces for runtime exceptions (Only for Java)"; "Report error traces for runtime exceptions (Only for Java)";
"-allow_specs_cleanup", Arg.Unit (fun () -> allow_specs_cleanup := true), None, "-allow_specs_cleanup", Arg.Unit (fun () -> allow_specs_cleanup := true), None,
"Allow to remove existing specs before running analysis when it's not incremental" "Allow to remove existing specs before running analysis when it's not incremental";
"-print_buckets", Arg.Unit (fun() -> Config.show_buckets := true; Config.show_ml_buckets := true), None,
"Add buckets to issue descriptions, useful when developing infer"
] in ] in
Arg2.create_options_desc false "Reserved Options: Experimental features, use with caution!" desc in Arg2.create_options_desc false "Reserved Options: Experimental features, use with caution!" desc in
base_arg @ reserved_arg base_arg @ reserved_arg

Loading…
Cancel
Save