Skip to content

Commit

Permalink
[infer][differential] remove the option to prevent the conflicts betw…
Browse files Browse the repository at this point in the history
…een Eradicate and Biabduction

Reviewed By: martinoluca

Differential Revision: D5516126

fbshipit-source-id: 5b0052a
  • Loading branch information
jeremydubreil authored and facebook-github-bot committed Jul 29, 2017
1 parent f2cb85e commit e0ad3a9
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 200 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ endif # BUILD_C_ANALYZERS
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
BUILD_SYSTEMS_TESTS += \
differential_interesting_paths_filter \
differential_resolve_infer_eradicate_conflict \
differential_skip_anonymous_class_renamings \
differential_skip_duplicated_types_on_filenames \
differential_skip_duplicated_types_on_filenames_with_renamings \
Expand Down
27 changes: 1 addition & 26 deletions infer/src/backend/DifferentialFilters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,6 @@ let skip_anonymous_class_renamings (diff: Differential.t) : Differential.t =
in
{introduced; fixed; preexisting= preexisting @ diff.preexisting}
(* Filter out null dereferences reported by infer if file has eradicate
enabled, to avoid double reporting. *)
let resolve_infer_eradicate_conflict (analyzer: Config.analyzer)
(filters_of_analyzer: Config.analyzer -> Inferconfig.filters) (diff: Differential.t)
: Differential.t =
let should_discard_issue (issue: Jsonbug_t.jsonbug) =
let file_is_whitelisted () =
let source_file = SourceFile.UNSAFE.from_string issue.file in
let filters = filters_of_analyzer Config.Eradicate in
filters.path_filter source_file
in
Config.equal_analyzer analyzer Config.BiAbduction
&& String.equal issue.bug_type (Localise.to_issue_id Localise.null_dereference)
&& file_is_whitelisted ()
in
let filter issues = List.filter ~f:(Fn.non should_discard_issue) issues in
{ introduced= filter diff.introduced
; fixed= filter diff.fixed
; preexisting= filter diff.preexisting }
(* Strip issues whose paths are not among those we're interested in *)
let interesting_paths_filter (interesting_paths: SourceFile.t list option) =
match interesting_paths with
Expand Down Expand Up @@ -259,10 +239,7 @@ let do_filter (diff: Differential.t) (renamings: FileRenamings.t) ~(skip_duplica
skip_anonymous_class_renamings
else Fn.id )
|> (if skip_duplicated_types then skip_duplicated_types_on_filenames renamings else Fn.id)
|>
if Config.resolve_infer_eradicate_conflict then
resolve_infer_eradicate_conflict Config.analyzer Inferconfig.create_filters
else Fn.id
|> Fn.id
in
{ introduced= apply_paths_filter_if_needed `Introduced diff'.introduced
; fixed= apply_paths_filter_if_needed `Fixed diff'.fixed
Expand All @@ -279,7 +256,5 @@ module VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY = struct
let skip_anonymous_class_renamings = skip_anonymous_class_renamings
let resolve_infer_eradicate_conflict = resolve_infer_eradicate_conflict
let interesting_paths_filter = interesting_paths_filter
end
3 changes: 0 additions & 3 deletions infer/src/backend/DifferentialFilters.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ module VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY : sig

val skip_anonymous_class_renamings : Differential.t -> Differential.t

val resolve_infer_eradicate_conflict :
Config.analyzer -> (Config.analyzer -> Inferconfig.filters) -> Differential.t -> Differential.t

val interesting_paths_filter :
SourceFile.t list option -> Jsonbug_t.jsonbug list -> Jsonbug_t.jsonbug list
end
7 changes: 0 additions & 7 deletions infer/src/base/Config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1442,11 +1442,6 @@ and report_previous =
and resource_leak =
CLOpt.mk_bool ~long:"resource-leak" ~default:false "the resource leak analysis (experimental)"

and resolve_infer_eradicate_conflict =
CLOpt.mk_bool ~long:"resolve-infer-eradicate-conflict" ~default:false
~in_help:CLOpt.([(ReportDiff, manual_generic)])
"Filter out Null Dereferences reported by Infer if Eradicate is enabled"

and rest =
CLOpt.mk_rest_actions ~in_help:CLOpt.([(Capture, manual_generic); (Run, manual_generic)])
"Stop argument processing, use remaining arguments as a build command" ~usage:exe_usage
Expand Down Expand Up @@ -2122,8 +2117,6 @@ and report_previous = !report_previous

and reports_include_ml_loc = !reports_include_ml_loc

and resolve_infer_eradicate_conflict = !resolve_infer_eradicate_conflict

and resource_leak = !resource_leak

and results_dir = !results_dir
Expand Down
2 changes: 0 additions & 2 deletions infer/src/base/Config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,6 @@ val tracing : bool

val reports_include_ml_loc : bool

val resolve_infer_eradicate_conflict : bool

val resource_leak : bool

val results_dir : string
Expand Down
50 changes: 1 addition & 49 deletions infer/src/unit/DifferentialFiltersTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -321,54 +321,6 @@ let test_skip_anonymous_class_renamings =
, ([1], [2], []) ) ]
|> List.map ~f:(fun (name, diff, expected_output) -> name >:: create_test diff expected_output)

let test_resolve_infer_eradicate_conflict =
let fake_filters_factory analyzer =
match analyzer with
| Config.Eradicate
-> { Inferconfig.path_filter= (function _ -> true)
; (* all paths are whitelisted *)
error_filter= (function _ -> failwith "error_filter is not needed")
; proc_filter= (function _ -> failwith "proc_filter is not needed") }
| _
-> failwith "This mock only supports Eradicate"
in
let create_test analyzer (exp_introduced, exp_fixed, exp_preexisting) _ =
let null_dereference = Localise.to_issue_id Localise.null_dereference in
let current_report =
[ create_fake_jsonbug ~bug_type:"bug_type_1" ~file:"file_1.java" ~hash:1 ()
; create_fake_jsonbug ~bug_type:null_dereference ~file:"file_2.java" ~hash:2 ()
; create_fake_jsonbug ~bug_type:"bug_type_1" ~file:"file_4.java" ~hash:4 () ]
in
let previous_report =
[ create_fake_jsonbug ~bug_type:"bug_type_1" ~file:"file_1.java" ~hash:11 ()
; create_fake_jsonbug ~bug_type:null_dereference ~file:"file_3.java" ~hash:3 ()
; create_fake_jsonbug ~bug_type:"bug_type_1" ~file:"file_4.java" ~hash:4 () ]
in
let diff = Differential.of_reports ~current_report ~previous_report in
let diff' =
DifferentialFilters.VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY.resolve_infer_eradicate_conflict
analyzer fake_filters_factory diff
in
assert_equal ~pp_diff:(pp_diff_of_int_list "Hashes of introduced") exp_introduced
(sorted_hashes_of_issues diff'.introduced) ;
assert_equal ~pp_diff:(pp_diff_of_int_list "Hashes of fixed") exp_fixed
(sorted_hashes_of_issues diff'.fixed) ;
assert_equal ~pp_diff:(pp_diff_of_int_list "Hashes of preexisting") exp_preexisting
(sorted_hashes_of_issues diff'.preexisting)
in
(* [(test_name, analyzer, expected_hashes); ...] *)
[ ( "test_resolve_infer_eradicate_conflict_runs_with_infer_analyzer"
, Config.BiAbduction
, ([1], [11], [4]) )
; ( "test_resolve_infer_eradicate_conflict_skips_with_checkers_analyzer"
, Config.Checkers
, ([1; 2], [3; 11], [4]) )
; ( "test_resolve_infer_eradicate_conflict_skips_with_linters_analyzer"
, Config.Linters
, ([1; 2], [3; 11], [4]) ) ]
|> List.map ~f:(fun (name, analyzer, expected_output) ->
name >:: create_test analyzer expected_output )

let test_interesting_paths_filter =
let report =
[ create_fake_jsonbug ~bug_type:"bug_type_1" ~file:"file_1.java" ~hash:1 ()
Expand Down Expand Up @@ -403,5 +355,5 @@ let tests =
"differential_filters_suite"
>::: test_file_renamings_from_json @ test_file_renamings_find_previous
@ test_relative_complements @ test_skip_anonymous_class_renamings
@ test_resolve_infer_eradicate_conflict @ test_interesting_paths_filter
@ test_interesting_paths_filter
@ [test_skip_duplicated_types_on_filenames; test_value_of_qualifier_tag]

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e0ad3a9

Please sign in to comment.