@ -98,6 +98,11 @@ module type MATCHABLE_JSON = sig
val json_key : string
val json_key : string
end
end
module type Matcher = sig
type matcher = DB . source_file -> Procname . t -> bool
val load_matcher : string -> matcher
end
module FileOrProcMatcher = functor ( M : MATCHABLE_JSON ) ->
module FileOrProcMatcher = functor ( M : MATCHABLE_JSON ) ->
struct
struct
@ -305,17 +310,6 @@ let load_filters analyzer =
with Sys_error _ -> None
with Sys_error _ -> None
else None
else None
(* * parse autogenerated list of procedures/classes with Java @SuppressWarnings annotations. This
list is generated by an annotation parser than runs with the javac compilation step and saved in
the [ local_config ] file * )
let make_proc_filter_from_local_config () =
let filter = match ! local_config with
| Some f ->
( try ProcMatcher . load_matcher f
with Yojson . Json_error _ -> ProcMatcher . default_matcher )
| None -> ProcMatcher . default_matcher in
fun pname -> not ( filter DB . source_file_empty pname )
let filters_from_inferconfig inferconfig : filters =
let filters_from_inferconfig inferconfig : filters =
let path_filter =
let path_filter =
@ -340,17 +334,15 @@ let filters_from_inferconfig inferconfig : filters =
proc_filter = default_proc_filter ;
proc_filter = default_proc_filter ;
}
}
(* Create filters based on .inferconfig . *)
(* Create filters based on .inferconfig *)
(* The environment varialble NO_PATH_FILTERING disables path filtering. *)
(* The environment varialble NO_PATH_FILTERING disables path filtering. *)
let create_filters analyzer =
let create_filters analyzer =
Config . project_root := Some ( Sys . getcwd () ) ;
Config . project_root := Some ( Sys . getcwd () ) ;
if Config . from_env_variable " NO_PATH_FILTERING " then do_not_filter
if Config . from_env_variable " NO_PATH_FILTERING " then do_not_filter
else
else
let filters =
match load_filters ( Utils . string_of_analyzer analyzer ) with
match load_filters ( Utils . string_of_analyzer analyzer ) with
| None -> do_not_filter
| None -> do_not_filter
| Some inferconfig -> filters_from_inferconfig inferconfig in
| Some inferconfig -> filters_from_inferconfig inferconfig
{ filters with proc_filter = make_proc_filter_from_local_config () }
(* This function loads and list the path that are being filtered by the analyzer. The results *)
(* 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 *)
(* are of the form: path/to/file.java -> {infer, eradicate} meaning that analysis results will *)