[infer][checkers] add missing command line flags to enable/disable the checkers enabled by default

Summary: We can now turn on and off every checker individually

Reviewed By: jberdine

Differential Revision: D5058497

fbshipit-source-id: 6791f0d
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 5773a903c6
commit 7d0375d9ee

@ -511,7 +511,14 @@ and angelic_execution =
"Angelic execution, where the analysis ignores errors caused by unknown procedure calls" "Angelic execution, where the analysis ignores errors caused by unknown procedure calls"
and annotation_reachability = and annotation_reachability =
CLOpt.mk_json ~long:"annotation-reachability" CLOpt.mk_bool ~long:"annotation-reachability" ~in_help:CLOpt.[Analyze, manual_generic]
"the annotation reachability checker. Given a pair of source and sink annotation, e.g. \
@PerformanceCritical and @Expensive, this checker will warn whenever some method annotated \
with @PerformanceCritical calls, directly or indirectly, another method annotated with \
@Expensive"
and annotation_reachability_custom_pairs =
CLOpt.mk_json ~long:"annotation-reachability-custom-pairs"
~in_help:CLOpt.[Analyze, manual_java] ~in_help:CLOpt.[Analyze, manual_java]
"Specify custom sources/sink for the annotation reachability checker\n\ "Specify custom sources/sink for the annotation reachability checker\n\
Example format: for custom annotations com.my.annotation.{Source1,Source2,Sink1}\n\ Example format: for custom annotations com.my.annotation.{Source1,Source2,Sink1}\n\
@ -844,7 +851,7 @@ and enable_checks =
and eradicate = and eradicate =
CLOpt.mk_bool ~long:"eradicate" ~in_help:CLOpt.[Analyze, manual_generic] CLOpt.mk_bool ~long:"eradicate" ~in_help:CLOpt.[Analyze, manual_generic]
"the eradicate checker for Java annotations" "the eradicate @Nullable checker for Java annotations"
and eradicate_condition_redundant = and eradicate_condition_redundant =
CLOpt.mk_bool ~long:"eradicate-condition-redundant" CLOpt.mk_bool ~long:"eradicate-condition-redundant"
@ -972,6 +979,12 @@ and icfg_dotty_outfile =
"If set, specifies path where .dot file should be written, it overrides the path for all \ "If set, specifies path where .dot file should be written, it overrides the path for all \
other options that would generate icfg file otherwise" other options that would generate icfg file otherwise"
and immutable_cast =
CLOpt.mk_bool ~long:"immutable-cast" ~in_help:CLOpt.[Analyze, manual_generic]
"the detection of object cast from immutable type to mutable type. \
For instance, it will detect cast from ImmutableList to List, ImmutableMap to Map, \
and ImmutableSet to Set."
and infer_cache = and infer_cache =
CLOpt.mk_path_opt ~deprecated:["infer_cache"; "-infer_cache"] ~long:"infer-cache" CLOpt.mk_path_opt ~deprecated:["infer_cache"; "-infer_cache"] ~long:"infer-cache"
~meta:"dir" "Select a directory to contain the infer cache (Buck and Java only)" ~meta:"dir" "Select a directory to contain the infer cache (Buck and Java only)"
@ -1139,6 +1152,12 @@ and print_builtins =
CLOpt.mk_bool ~deprecated:["print_builtins"] ~long:"print-builtins" CLOpt.mk_bool ~deprecated:["print_builtins"] ~long:"print-builtins"
"Print the builtin functions and exit" "Print the builtin functions and exit"
and printf_args =
CLOpt.mk_bool ~long:"printf-args" ~in_help:CLOpt.[Analyze, manual_generic]
"the detection of mismatch between the Java printf format strings and the argument types \
For, example, this checker will warn about the type error in \
`printf(\"Hello %d\", \"world\")`"
and print_using_diff = and print_using_diff =
CLOpt.mk_bool ~deprecated_no:["noprintdiff"] ~long:"print-using-diff" ~default:true CLOpt.mk_bool ~deprecated_no:["noprintdiff"] ~long:"print-using-diff" ~default:true
"Highlight the difference w.r.t. the previous prop when printing symbolic execution debug info" "Highlight the difference w.r.t. the previous prop when printing symbolic execution debug info"
@ -1656,6 +1675,7 @@ and analysis_suppress_errors_options =
and analysis_stops = !analysis_stops and analysis_stops = !analysis_stops
and angelic_execution = !angelic_execution and angelic_execution = !angelic_execution
and annotation_reachability = !annotation_reachability and annotation_reachability = !annotation_reachability
and annotation_reachability_custom_pairs = !annotation_reachability_custom_pairs
and array_level = !array_level and array_level = !array_level
and ast_file = !ast_file and ast_file = !ast_file
and biabduction = !biabduction and biabduction = !biabduction
@ -1724,6 +1744,7 @@ and frontend_debug = !frontend_debug
and frontend_stats = !frontend_stats and frontend_stats = !frontend_stats
and headers = !headers and headers = !headers
and icfg_dotty_outfile = !icfg_dotty_outfile and icfg_dotty_outfile = !icfg_dotty_outfile
and immutable_cast = !immutable_cast
and infer_cache = !infer_cache and infer_cache = !infer_cache
and iphoneos_target_sdk_version = !iphoneos_target_sdk_version and iphoneos_target_sdk_version = !iphoneos_target_sdk_version
and issues_fields = !issues_fields and issues_fields = !issues_fields
@ -1759,6 +1780,7 @@ and patterns_modeled_expensive = match patterns_modeled_expensive with (k,r) ->
and per_procedure_parallelism = !per_procedure_parallelism and per_procedure_parallelism = !per_procedure_parallelism
and pmd_xml = !pmd_xml and pmd_xml = !pmd_xml
and precondition_stats = !precondition_stats and precondition_stats = !precondition_stats
and printf_args = !printf_args
and print_logs = !print_logs and print_logs = !print_logs
and print_builtins = !print_builtins and print_builtins = !print_builtins
and print_types = !print_types and print_types = !print_types

@ -166,7 +166,8 @@ val analysis_stops : bool
val analysis_suppress_errors : analyzer -> string list val analysis_suppress_errors : analyzer -> string list
val analyzer : analyzer val analyzer : analyzer
val angelic_execution : bool val angelic_execution : bool
val annotation_reachability : Yojson.Basic.json val annotation_reachability : bool
val annotation_reachability_custom_pairs : Yojson.Basic.json
val array_level : int val array_level : int
val ast_file : string option val ast_file : string option
val biabduction : bool val biabduction : bool
@ -242,6 +243,7 @@ val frontend_stats : bool
val generated_classes : string option val generated_classes : string option
val headers : bool val headers : bool
val icfg_dotty_outfile : string option val icfg_dotty_outfile : string option
val immutable_cast : bool
val infer_cache : string option val infer_cache : string option
val iphoneos_target_sdk_version : string option val iphoneos_target_sdk_version : string option
val issues_fields : [`Issue_field_bug_class val issues_fields : [`Issue_field_bug_class
@ -292,6 +294,7 @@ val print_logs : bool
val print_builtins : bool val print_builtins : bool
val print_types : bool val print_types : bool
val print_using_diff : bool val print_using_diff : bool
val printf_args : bool
val procedures_per_process : int val procedures_per_process : int
val procs_csv : string option val procs_csv : string option
val procs_xml : string option val procs_xml : string option

@ -35,7 +35,7 @@ let src_snk_pairs =
([Annotations.no_allocation], dummy_constructor_annot) :: ([Annotations.no_allocation], dummy_constructor_annot) ::
([Annotations.any_thread; Annotations.for_non_ui_thread], Annotations.ui_thread) :: ([Annotations.any_thread; Annotations.for_non_ui_thread], Annotations.ui_thread) ::
([Annotations.ui_thread; Annotations.for_ui_thread], Annotations.for_non_ui_thread) :: ([Annotations.ui_thread; Annotations.for_ui_thread], Annotations.for_non_ui_thread) ::
(parse_user_defined_specs Config.annotation_reachability) in (parse_user_defined_specs Config.annotation_reachability_custom_pairs) in
List.map List.map
~f:(fun (src_annot_str_list, snk_annot_str) -> ~f:(fun (src_annot_str_list, snk_annot_str) ->
List.map ~f:annotation_of_str src_annot_str_list, annotation_of_str snk_annot_str) List.map ~f:annotation_of_str src_annot_str_list, annotation_of_str snk_annot_str)

@ -31,10 +31,11 @@ let active_procedure_checkers () =
Eradicate.callback_eradicate, Config.eradicate; Eradicate.callback_eradicate, Config.eradicate;
BoundedCallTree.checker, Config.crashcontext; BoundedCallTree.checker, Config.crashcontext;
JavaTaintAnalysis.checker, Config.quandary || enabled_by_default; JavaTaintAnalysis.checker, Config.quandary || enabled_by_default;
ImmutableChecker.callback_check_immutable_cast, enabled_by_default; ImmutableChecker.callback_check_immutable_cast, enabled_by_default
|| Config.immutable_cast;
RepeatedCallsChecker.callback_check_repeated_calls, Config.checkers_repeated_calls; RepeatedCallsChecker.callback_check_repeated_calls, Config.checkers_repeated_calls;
PrintfArgs.callback_printf_args, enabled_by_default; PrintfArgs.callback_printf_args, enabled_by_default || Config.printf_args;
AnnotationReachability.checker, enabled_by_default; AnnotationReachability.checker, enabled_by_default || Config.annotation_reachability;
BufferOverrunChecker.checker, Config.bufferoverrun; BufferOverrunChecker.checker, Config.bufferoverrun;
ThreadSafety.analyze_procedure, enabled_by_default || Config.threadsafety; ThreadSafety.analyze_procedure, enabled_by_default || Config.threadsafety;
Interproc.analyze_procedure, Config.biabduction; Interproc.analyze_procedure, Config.biabduction;

@ -11,7 +11,7 @@
"method": "findViewById" "method": "findViewById"
} }
], ],
"annotation-reachability": [ "annotation-reachability-custom-pairs": [
{ {
"sources": ["UserDefinedSource1", "UserDefinedSource2"], "sources": ["UserDefinedSource1", "UserDefinedSource2"],
"sink": "UserDefinedSink" "sink": "UserDefinedSink"

Loading…
Cancel
Save