From 707e7b2daa4bb9d7183ba9f9a7ce47a11dc2d968 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Mon, 14 Oct 2019 06:10:39 -0700 Subject: [PATCH] [config] saner names and doc for blacklist options Summary: Describe what the --report-*-* options actually do instead of their outdated documentation from the time where this was `--checkers-blacklist-regex`, `--infer-blacklist-regex` and the like. Reviewed By: dulmarod, mityal Differential Revision: D17906015 fbshipit-source-id: 204349e9e --- infer/man/man1/infer-capture.txt | 6 +-- infer/man/man1/infer-full.txt | 21 +++++---- infer/man/man1/infer-report.txt | 14 +++--- infer/man/man1/infer-run.txt | 14 +++--- infer/man/man1/infer.txt | 21 +++++---- infer/src/backend/inferconfig.ml | 8 ++-- infer/src/base/Config.ml | 77 ++++++++++++++++---------------- infer/src/base/Config.mli | 16 +++---- 8 files changed, 98 insertions(+), 79 deletions(-) diff --git a/infer/man/man1/infer-capture.txt b/infer/man/man1/infer-capture.txt index 8b86ee47d..a96ca1b84 100644 --- a/infer/man/man1/infer-capture.txt +++ b/infer/man/man1/infer-capture.txt @@ -134,9 +134,9 @@ BUCK FLAVORS OPTIONS expression (only supported by the javac integration for now). --flavors - Activates: Buck integration using Buck flavors (clang only), eg - `infer --flavors -- buck build //foo:bar#infer` (Conversely: - --no-flavors) + Activates: Buck integration using the infer-capture-all Buck + flavor (clang only). Use for clang-based Buck projects (as opposed + to Java). (Conversely: --no-flavors) --Xbuck +string Pass values as command-line arguments to invocations of `buck diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 196ee4964..dd6961ac5 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -533,9 +533,9 @@ OPTIONS types (Conversely: --filtering | -f) See also infer-report(1). --flavors - Activates: Buck integration using Buck flavors (clang only), eg - `infer --flavors -- buck build //foo:bar#infer` (Conversely: - --no-flavors) See also infer-capture(1). + Activates: Buck integration using the infer-capture-all Buck + flavor (clang only). Use for clang-based Buck projects (as opposed + to Java). (Conversely: --no-flavors) See also infer-capture(1). --force-delete-results-dir Activates: Do not refuse to delete the results directory if it @@ -941,13 +941,13 @@ OPTIONS completed (Conversely: --report) See also infer-analyze(1) and infer-run(1). --report-blacklist-files-containing +string - blacklist files containing the specified string for the given - analyzer (see --analyzer for valid values) See also infer-report(1) and infer-run(1). + Do not report any issues on files containing the specified string + See also infer-report(1) and infer-run(1). --report-blacklist-path-regex +path_regex - blacklist the analysis of files whose relative path matches the - specified OCaml-style regex (to whitelist: - ---whitelist-path-regex) See also infer-report(1) and infer-run(1). + Do not report any issues on files whose relative path matches the + specified OCaml regex, even if they match the whitelist specified + by --report-whitelist-path-regex See also infer-report(1) and infer-run(1). --report-current path report of the latest revision See also infer-reportdiff(1). @@ -971,6 +971,11 @@ OPTIONS --report-suppress-errors +error_name do not report a type of errors See also infer-report(1) and infer-run(1). + --report-whitelist-path-regex +path_regex + Report issues only on files whose relative path matches the + specified OCaml regex (and which do not match + --report-blacklist-path-regex) See also infer-report(1) and infer-run(1). + --results-dir,-o dir Write results and internal files in the specified directory See also infer-analyze(1), infer-capture(1), infer-explore(1), diff --git a/infer/man/man1/infer-report.txt b/infer/man/man1/infer-report.txt index 14d86a241..dc7cf581f 100644 --- a/infer/man/man1/infer-report.txt +++ b/infer/man/man1/infer-report.txt @@ -294,13 +294,12 @@ OPTIONS print for the report command) (Conversely: --no-quiet | -Q) --report-blacklist-files-containing +string - blacklist files containing the specified string for the given - analyzer (see --analyzer for valid values) + Do not report any issues on files containing the specified string --report-blacklist-path-regex +path_regex - blacklist the analysis of files whose relative path matches the - specified OCaml-style regex (to whitelist: - ---whitelist-path-regex) + Do not report any issues on files whose relative path matches the + specified OCaml regex, even if they match the whitelist specified + by --report-whitelist-path-regex --report-formatter { none | phabricator } Which formatter to use when emitting the report @@ -308,6 +307,11 @@ OPTIONS --report-suppress-errors +error_name do not report a type of errors + --report-whitelist-path-regex +path_regex + Report issues only on files whose relative path matches the + specified OCaml regex (and which do not match + --report-blacklist-path-regex) + --results-dir,-o dir Write results and internal files in the specified directory diff --git a/infer/man/man1/infer-run.txt b/infer/man/man1/infer-run.txt index 9435b36c7..b909424f4 100644 --- a/infer/man/man1/infer-run.txt +++ b/infer/man/man1/infer-run.txt @@ -120,13 +120,12 @@ OPTIONS completed (Conversely: --report) --report-blacklist-files-containing +string - blacklist files containing the specified string for the given - analyzer (see --analyzer for valid values) + Do not report any issues on files containing the specified string --report-blacklist-path-regex +path_regex - blacklist the analysis of files whose relative path matches the - specified OCaml-style regex (to whitelist: - ---whitelist-path-regex) + Do not report any issues on files whose relative path matches the + specified OCaml regex, even if they match the whitelist specified + by --report-whitelist-path-regex --report-force-relative-path Activates: Force converting an absolute path to a relative path to @@ -140,6 +139,11 @@ OPTIONS --report-suppress-errors +error_name do not report a type of errors + --report-whitelist-path-regex +path_regex + Report issues only on files whose relative path matches the + specified OCaml regex (and which do not match + --report-blacklist-path-regex) + --results-dir,-o dir Write results and internal files in the specified directory diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index d92fbafb1..f0f611b0e 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -533,9 +533,9 @@ OPTIONS types (Conversely: --filtering | -f) See also infer-report(1). --flavors - Activates: Buck integration using Buck flavors (clang only), eg - `infer --flavors -- buck build //foo:bar#infer` (Conversely: - --no-flavors) See also infer-capture(1). + Activates: Buck integration using the infer-capture-all Buck + flavor (clang only). Use for clang-based Buck projects (as opposed + to Java). (Conversely: --no-flavors) See also infer-capture(1). --force-delete-results-dir Activates: Do not refuse to delete the results directory if it @@ -941,13 +941,13 @@ OPTIONS completed (Conversely: --report) See also infer-analyze(1) and infer-run(1). --report-blacklist-files-containing +string - blacklist files containing the specified string for the given - analyzer (see --analyzer for valid values) See also infer-report(1) and infer-run(1). + Do not report any issues on files containing the specified string + See also infer-report(1) and infer-run(1). --report-blacklist-path-regex +path_regex - blacklist the analysis of files whose relative path matches the - specified OCaml-style regex (to whitelist: - ---whitelist-path-regex) See also infer-report(1) and infer-run(1). + Do not report any issues on files whose relative path matches the + specified OCaml regex, even if they match the whitelist specified + by --report-whitelist-path-regex See also infer-report(1) and infer-run(1). --report-current path report of the latest revision See also infer-reportdiff(1). @@ -971,6 +971,11 @@ OPTIONS --report-suppress-errors +error_name do not report a type of errors See also infer-report(1) and infer-run(1). + --report-whitelist-path-regex +path_regex + Report issues only on files whose relative path matches the + specified OCaml regex (and which do not match + --report-blacklist-path-regex) See also infer-report(1) and infer-run(1). + --results-dir,-o dir Write results and internal files in the specified directory See also infer-analyze(1), infer-capture(1), infer-explore(1), diff --git a/infer/src/backend/inferconfig.ml b/infer/src/backend/inferconfig.ml index 7e22e22e1..cde2292f1 100644 --- a/infer/src/backend/inferconfig.ml +++ b/infer/src/backend/inferconfig.ml @@ -287,10 +287,10 @@ let skip_implementation_matcher = let load_filters () = - { whitelist= Config.analysis_path_regex_whitelist - ; blacklist= Config.analysis_path_regex_blacklist - ; blacklist_files_containing= Config.analysis_blacklist_files_containing - ; suppress_errors= Config.analysis_suppress_errors } + { whitelist= Config.report_path_regex_whitelist + ; blacklist= Config.report_path_regex_blacklist + ; blacklist_files_containing= Config.report_blacklist_files_containing + ; suppress_errors= Config.report_suppress_errors } let filters_from_inferconfig inferconfig : filters = diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index d4091523f..22543d960 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -619,34 +619,6 @@ and allow_leak = CLOpt.mk_bool ~deprecated:["leak"] ~long:"allow-leak" "Forget leaked memory during abstraction" -and ( analysis_blacklist_files_containing - , analysis_path_regex_blacklist - , analysis_path_regex_whitelist - , analysis_suppress_errors ) = - let mk_filtering_option ~suffix ~help ~meta = - let deprecated = - List.map ["checkers"; "infer"] ~f:(fun name -> Printf.sprintf "%s-%s" name suffix) - in - let long = Printf.sprintf "report-%s" suffix in - CLOpt.mk_string_list ~deprecated ~long ~meta - ~in_help:InferCommand.[(Report, manual_generic); (Run, manual_generic)] - help - in - ( mk_filtering_option ~suffix:"blacklist-files-containing" - ~help: - "blacklist files containing the specified string for the given analyzer (see \ - $(b,--analyzer) for valid values)" - ~meta:"string" - , mk_filtering_option ~suffix:"blacklist-path-regex" - ~help: - "blacklist the analysis of files whose relative path matches the specified OCaml-style \ - regex (to whitelist: $(b,---whitelist-path-regex))" - ~meta:"path_regex" - , mk_filtering_option ~suffix:"whitelist-path-regex" ~help:"" ~meta:"path_regex" - , mk_filtering_option ~suffix:"suppress-errors" ~help:"do not report a type of errors" - ~meta:"error_name" ) - - and analysis_stops = CLOpt.mk_bool ~deprecated:["analysis_stops"] ~long:"analysis-stops" "Issue a warning when the analysis stops" @@ -1451,8 +1423,8 @@ and filter_paths = and flavors = CLOpt.mk_bool ~deprecated:["-use-flavors"] ~long:"flavors" ~in_help:InferCommand.[(Capture, manual_buck_flavors)] - "Buck integration using Buck flavors (clang only), eg $(i,`infer --flavors -- buck build \ - //foo:bar#infer`)" + "Buck integration using the infer-capture-all Buck flavor (clang only). Use for clang-based \ + Buck projects (as opposed to Java)." and force_delete_results_dir = @@ -2032,6 +2004,35 @@ and report = "Run the reporting phase once the analysis has completed" +and ( report_blacklist_files_containing + , report_path_regex_blacklist + , report_path_regex_whitelist + , report_suppress_errors ) = + let mk_filtering_option ~suffix ~help ~meta = + let deprecated = + List.map ["checkers"; "infer"] ~f:(fun name -> Printf.sprintf "%s-%s" name suffix) + in + let long = Printf.sprintf "report-%s" suffix in + CLOpt.mk_string_list ~deprecated ~long ~meta + ~in_help:InferCommand.[(Report, manual_generic); (Run, manual_generic)] + help + in + ( mk_filtering_option ~suffix:"blacklist-files-containing" + ~help:"Do not report any issues on files containing the specified string" ~meta:"string" + , mk_filtering_option ~suffix:"blacklist-path-regex" + ~help: + "Do not report any issues on files whose relative path matches the specified OCaml regex, \ + even if they match the whitelist specified by $(b,--report-whitelist-path-regex)" + ~meta:"path_regex" + , mk_filtering_option ~suffix:"whitelist-path-regex" + ~help: + "Report issues only on files whose relative path matches the specified OCaml regex (and \ + which do not match $(b,--report-blacklist-path-regex))" + ~meta:"path_regex" + , mk_filtering_option ~suffix:"suppress-errors" ~help:"do not report a type of errors" + ~meta:"error_name" ) + + and report_current = CLOpt.mk_path_opt ~long:"report-current" ~in_help:InferCommand.[(ReportDiff, manual_generic)] @@ -2699,14 +2700,6 @@ and abs_val = !abs_val and allow_leak = !allow_leak -and analysis_path_regex_whitelist = !analysis_path_regex_whitelist - -and analysis_path_regex_blacklist = !analysis_path_regex_blacklist - -and analysis_blacklist_files_containing = !analysis_blacklist_files_containing - -and analysis_suppress_errors = !analysis_suppress_errors - and analysis_stops = !analysis_stops and annotation_reachability = !annotation_reachability @@ -3100,6 +3093,8 @@ and relative_path_backtrack = !relative_path_backtrack and report = !report +and report_blacklist_files_containing = !report_blacklist_files_containing + and report_current = !report_current and report_custom_error = !report_custom_error @@ -3110,8 +3105,14 @@ and report_formatter = !report_formatter and report_hook = !report_hook +and report_path_regex_blacklist = !report_path_regex_blacklist + +and report_path_regex_whitelist = !report_path_regex_whitelist + and report_previous = !report_previous +and report_suppress_errors = !report_suppress_errors + and reports_include_ml_loc = !reports_include_ml_loc and resource_leak = !resource_leak diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 26005c38a..b6f9a14cd 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -207,16 +207,8 @@ val abs_val : int val allow_leak : bool -val analysis_blacklist_files_containing : string list - -val analysis_path_regex_blacklist : string list - -val analysis_path_regex_whitelist : string list - val analysis_stops : bool -val analysis_suppress_errors : string list - val annotation_reachability : bool val annotation_reachability_cxx : Yojson.Basic.t @@ -588,14 +580,22 @@ val reactive_mode : bool val reanalyze : bool +val report_blacklist_files_containing : string list + val report_current : string option val report_formatter : [`No_formatter | `Phabricator_formatter] val report_hook : string option +val report_path_regex_blacklist : string list + +val report_path_regex_whitelist : string list + val report_previous : string option +val report_suppress_errors : string list + val reports_include_ml_loc : bool val resource_leak : bool