diff --git a/infer/src/backend/config.ml b/infer/src/backend/config.ml index 5ef6a0850..fb79740f4 100644 --- a/infer/src/backend/config.ml +++ b/infer/src/backend/config.ml @@ -916,7 +916,7 @@ and ( mk_option ~deprecated:["never_returning_null"] ~long:"never-returning-null" "Matcher or list of matchers for functions that never return `null`.", mk_option ~deprecated:["skip_translation"] ~long:"skip-translation" - "Matcher or list of matchers for names of files that should be analyzed at all.") + "Matcher or list of matchers for names of files that should not be analyzed at all.") and pmd_xml = CLOpt.mk_bool ~long:"pmd-xml" @@ -988,6 +988,11 @@ and skip_clang_analysis_in_path = ~exes:CLOpt.[Clang] ~meta:"path prefix" "Ignore files whose path matches the given prefix" +and skip_analysis_in_path = + CLOpt.mk_string_list ~long:"skip-analysis-in-path" + ~exes:CLOpt.[Clang;Java] + ~meta:"path prefix" "Ignore files whose path matches the given prefix" + and skip_translation_headers = CLOpt.mk_string_list ~deprecated:["skip_translation_headers"] ~long:"skip-translation-headers" ~exes:CLOpt.[Clang] @@ -1464,6 +1469,7 @@ and save_analysis_results = !save_results and seconds_per_iteration = !seconds_per_iteration and show_buckets = !print_buckets and show_progress_bar = !progress_bar +and skip_analysis_in_path = !skip_analysis_in_path and skip_clang_analysis_in_path = !skip_clang_analysis_in_path and skip_translation_headers = !skip_translation_headers and source_file = !source_file diff --git a/infer/src/backend/config.mli b/infer/src/backend/config.mli index a0a4a9c75..d34e4d2a2 100644 --- a/infer/src/backend/config.mli +++ b/infer/src/backend/config.mli @@ -238,6 +238,7 @@ val save_analysis_results : string option val seconds_per_iteration : float val show_buckets : bool val show_progress_bar : bool +val skip_analysis_in_path : string list val skip_clang_analysis_in_path : string list val skip_translation_headers : string list val source_file : string option diff --git a/infer/src/java/jMain.ml b/infer/src/java/jMain.ml index 7bda86201..5f9d199f1 100644 --- a/infer/src/java/jMain.ml +++ b/infer/src/java/jMain.ml @@ -126,7 +126,13 @@ let do_all_files classpath sources classes = let program = JClasspath.load_program classpath classes in let tenv = load_tenv () in let linereader = Printer.LineReader.create () in - let skip source_file = Inferconfig.skip_translation_matcher source_file Procname.empty_block in + let skip source_file = + let is_path_matching path = + IList.exists + (fun pattern -> Str.string_match (Str.regexp pattern) path 0) + Config.skip_analysis_in_path in + is_path_matching (DB.source_file_to_rel_path source_file) + || Inferconfig.skip_translation_matcher source_file Procname.empty_block in let translate_source_file basename (package_opt, _) source_file = init_global_state source_file; if not (skip source_file) then