diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index 95a009e2d..e62e4af71 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -308,25 +308,7 @@ let should_report (issue_kind: Exceptions.err_kind) issue_type error_desc eclass }; issue_bucket_is_high } else { - let blacklisted_by_default = - Localise.[ - analysis_stops, - divide_by_zero, - return_value_ignored, - array_out_of_bounds_l1, - array_out_of_bounds_l2, - array_out_of_bounds_l3, - null_test_after_dereference, - class_cast_exception, - uninitialized_value, - stack_variable_address_escape, - dangling_pointer_dereference, - unary_minus_applied_to_unsigned_expression, - condition_always_true, - condition_always_false, - retain_cycle - ]; - not (List.mem equal::Localise.equal blacklisted_by_default issue_type) + true } } } diff --git a/infer/src/backend/inferconfig.ml b/infer/src/backend/inferconfig.ml index 7910c8e6e..70326a10a 100644 --- a/infer/src/backend/inferconfig.ml +++ b/infer/src/backend/inferconfig.ml @@ -348,17 +348,14 @@ let create_filters analyzer = (* Decide whether a checker or error type is enabled or disabled based on*) (* white/black listing in .inferconfig and the default value *) let is_checker_enabled checker_name = - match List.mem ~equal:String.(=) Config.disable_checks checker_name, - List.mem ~equal:String.(=) Config.enable_checks checker_name with - | false, false -> (* if it's not amond white/black listed then we use default value *) - not (List.mem ~equal:String.(=) Config.checks_disabled_by_default checker_name) - | true, false -> (* if it's blacklisted and not whitelisted then it should be disabled *) - false - | false, true -> (* if it is not blacklisted and it is whitelisted then it should be enabled *) - true - | true, true -> (* if it's both blacklisted and whitelisted then we flag error *) - failwithf "Inconsistent settings: checker %s is both blacklisted and whitelisted." - checker_name + (* no-filtering takes priority over both whitelist and blacklist *) + (not Config.filtering) + (* whitelist takes priority over blacklist *) + || (List.mem ~equal:String.(=) Config.enable_checks checker_name) + (* if it's blacklisted and not whitelisted then it should be disabled *) + || ((not (List.mem ~equal:String.(=) Config.disable_checks checker_name)) + (* if it's not amond white/black listed then we use default value *) + && not (List.mem ~equal:String.(=) Config.checks_disabled_by_default checker_name)) (* This function loads and list the path that are being filtered by the analyzer. The results *) (* are of the form: path/to/file.java -> {infer, eradicate} meaning that analysis results will *) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index b3b62926f..4e1a7b647 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -845,8 +845,7 @@ and ( and filtering = CLOpt.mk_bool ~deprecated_no:["nf"] ~long:"filtering" ~short:'f' ~default:true ~in_help:CLOpt.[Report, manual_generic] - "Do not show the results from experimental checks (note: some of them may contain many false \ - alarms)" + "Do not show the results from experimental and blacklisted checks" and only_cheap_debug = CLOpt.mk_bool ~long:"only-cheap-debug" @@ -998,7 +997,25 @@ and differential_filter_set = and disable_checks = CLOpt.mk_string_list ~deprecated:["disable_checks"] ~long:"disable-checks" ~meta:"error name" ~in_help:CLOpt.[Report, manual_generic] - "Do not show reports coming from this type of errors" + ~default: [ + "ANALYSIS_STOPS"; + "ARRAY_OUT_OF_BOUNDS_L1"; + "ARRAY_OUT_OF_BOUNDS_L2"; + "ARRAY_OUT_OF_BOUNDS_L3"; + "CLASS_CAST_EXCEPTION"; + "CONDITION_ALWAYS_FALSE"; + "CONDITION_ALWAYS_TRUE"; + "DANGLING_POINTER_DEREFERENCE"; + "DIVIDE_BY_ZERO"; + "NULL_TEST_AFTER_DEREFERENCE"; + "RETAIN_CYCLE"; + "RETURN_VALUE_IGNORED"; + "STACK_VARIABLE_ADDRESS_ESCAPE"; + "UNARY_MINUS_APPLIED_TO_UNSIGNED_EXPRESSION"; + "UNINITIALIZED_VALUE"; + ] + "Do not show reports coming from this type of errors. This option has lower precedence than \ + $(b,--no-filtering) and $(b,--enable-checks)" and dotty_cfg_libs = CLOpt.mk_bool ~deprecated:["dotty_no_cfg_libs"] ~long:"dotty-cfg-libs" ~default:true @@ -1018,7 +1035,8 @@ and dynamic_dispatch = and enable_checks = CLOpt.mk_string_list ~deprecated:["enable_checks"] ~long:"enable-checks" ~meta:"error name" - "Show reports coming from this type of errors" + "Show reports coming from this type of errors. This option has higher precedence than \ + $(b,--disable-checks)" and eradicate_condition_redundant = CLOpt.mk_bool ~long:"eradicate-condition-redundant"