[config] Rename `filter-report` command to `censor-report` and stop reporting them on console and bugs.txt

Summary:
- Rename `filter-report` command to `censor-report`and update comments
- Stop reporting censored issues on the console and in `bugs.txt`

Reviewed By: jvillard

Differential Revision: D16540525

fbshipit-source-id: f5f7dcea3
master
Ezgi Çiçek 5 years ago committed by Facebook Github Bot
parent b3f52284ed
commit e320d8a580

@ -31,6 +31,7 @@ ISSUE_SEVERITY_ADVICE = 'ADVICE'
ISSUE_SEVERITY_LIKE = 'LIKE'
# field names in rows of json reports
JSON_INDEX_CENSORED_REASON = 'censored_reason'
JSON_INDEX_DOTTY = 'dotty'
JSON_INDEX_FILENAME = 'file'
JSON_INDEX_HASH = 'hash'
@ -177,7 +178,13 @@ def _text_of_report_list(project_root, reports, bugs_txt_path, limit=None,
return bug_list + summary
def _get_censored_reason(report):
return report.get(JSON_INDEX_CENSORED_REASON)
def _is_user_visible(report):
if _get_censored_reason(report) is not None:
return False
else:
return report[JSON_INDEX_SEVERITY] in [
ISSUE_SEVERITY_ERROR,
ISSUE_SEVERITY_WARNING,

@ -163,6 +163,26 @@ OPTIONS
expression (only supported by the javac integration for now).
See also infer-capture(1) and infer-run(1).
--censor-report +string
Specify a filter for issues to be censored by adding a
'censored_reason' field in the json report. Infer will not report
censored issues on the console output and in bugs.txt, but tools
that post-process the json report can take them into account. If
multiple filters are specified, they are applied in the order in
which they are specified. Each filter is applied to each issue
detected, and only issues which are accepted by all filters are
reported. Each filter is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered. See also infer-report(1) and infer-run(1).
--changed-files-index file
Specify the file containing the list of source files from which
reactive analysis should start. Source files should be specified
@ -514,23 +534,6 @@ OPTIONS
JSON with a list of file renamings to use while computing
differential reports See also infer-reportdiff(1).
--filter-report +string
Specify a filter for issues to report. If multiple filters are
specified, they are applied in the order in which they are
specified. Each filter is applied to each issue detected, and only
issues which are accepted by all filters are reported. Each filter
is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered. See also infer-report(1) and infer-run(1).
--no-filtering,-F
Deactivates: Do not show the experimental and blacklisted issue
types (Conversely: --filtering | -f) See also infer-report(1).
@ -1184,6 +1187,9 @@ INTERNAL OPTIONS
--capture-blacklist-reset
Cancel the effect of --capture-blacklist.
--censor-report-reset
Set --censor-report to the empty list.
--changed-files-index-reset
Cancel the effect of --changed-files-index.
@ -1355,9 +1361,6 @@ INTERNAL OPTIONS
Deactivates: Filters specified in .inferconfig (Conversely:
--filter-paths)
--filter-report-reset
Set --filter-report to the empty list.
--force-integration-reset
Cancel the effect of --force-integration.

@ -15,6 +15,26 @@ DESCRIPTION
OPTIONS
--censor-report +string
Specify a filter for issues to be censored by adding a
'censored_reason' field in the json report. Infer will not report
censored issues on the console output and in bugs.txt, but tools
that post-process the json report can take them into account. If
multiple filters are specified, they are applied in the order in
which they are specified. Each filter is applied to each issue
detected, and only issues which are accepted by all filters are
reported. Each filter is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered.
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
@ -227,23 +247,6 @@ OPTIONS
checker run; see individual checker options to turn them on or
off.
--filter-report +string
Specify a filter for issues to report. If multiple filters are
specified, they are applied in the order in which they are
specified. Each filter is applied to each issue detected, and only
issues which are accepted by all filters are reported. Each filter
is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered.
--no-filtering,-F
Deactivates: Do not show the experimental and blacklisted issue
types (Conversely: --filtering | -f)

@ -16,6 +16,26 @@ DESCRIPTION
OPTIONS
--censor-report +string
Specify a filter for issues to be censored by adding a
'censored_reason' field in the json report. Infer will not report
censored issues on the console output and in bugs.txt, but tools
that post-process the json report can take them into account. If
multiple filters are specified, they are applied in the order in
which they are specified. Each filter is applied to each issue
detected, and only issues which are accepted by all filters are
reported. Each filter is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered.
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
@ -45,23 +65,6 @@ OPTIONS
Activates: Exit with error code 2 if Infer found something to
report (Conversely: --no-fail-on-issue)
--filter-report +string
Specify a filter for issues to report. If multiple filters are
specified, they are applied in the order in which they are
specified. Each filter is applied to each issue detected, and only
issues which are accepted by all filters are reported. Each filter
is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered.
--force-delete-results-dir
Activates: Do not refuse to delete the results directory if it
doesn't look like an infer results directory. (Conversely:

@ -163,6 +163,26 @@ OPTIONS
expression (only supported by the javac integration for now).
See also infer-capture(1) and infer-run(1).
--censor-report +string
Specify a filter for issues to be censored by adding a
'censored_reason' field in the json report. Infer will not report
censored issues on the console output and in bugs.txt, but tools
that post-process the json report can take them into account. If
multiple filters are specified, they are applied in the order in
which they are specified. Each filter is applied to each issue
detected, and only issues which are accepted by all filters are
reported. Each filter is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered. See also infer-report(1) and infer-run(1).
--changed-files-index file
Specify the file containing the list of source files from which
reactive analysis should start. Source files should be specified
@ -514,23 +534,6 @@ OPTIONS
JSON with a list of file renamings to use while computing
differential reports See also infer-reportdiff(1).
--filter-report +string
Specify a filter for issues to report. If multiple filters are
specified, they are applied in the order in which they are
specified. Each filter is applied to each issue detected, and only
issues which are accepted by all filters are reported. Each filter
is of the form:
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first
two components are OCaml Str regular expressions, with an optional
`!` character prefix. If a regex has a `!` prefix, the polarity is
inverted, and the filter becomes a "blacklist" instead of a
"whitelist". Each filter is interpreted as an implication: an
issue matches if it does not match the `issue_type_regex` or if it
does match the `filename_regex`. The filenames that are tested by
the regex are relative to the `--project-root` directory. The
`<reason_string>` is a non-empty string used to explain why the
issue was filtered. See also infer-report(1) and infer-run(1).
--no-filtering,-F
Deactivates: Do not show the experimental and blacklisted issue
types (Conversely: --filtering | -f) See also infer-report(1).

@ -173,7 +173,7 @@ let censored_reason (issue_type : IssueType.t) source_file =
in
Option.some_if (not accepted) reason
in
List.find_map Config.filter_report ~f:rejected_by
List.find_map Config.censor_report ~f:rejected_by
let potential_exception_message = "potential exception at line"

@ -922,6 +922,23 @@ and capture_blacklist =
the javac integration for now)."
and censor_report =
CLOpt.mk_string_list ~long:"censor-report" ~deprecated:["-filter-report"]
~in_help:InferCommand.[(Report, manual_generic); (Run, manual_generic)]
"Specify a filter for issues to be censored by adding a 'censored_reason' field in the json \
report. Infer will not report censored issues on the console output and in bugs.txt, but \
tools that post-process the json report can take them into account. If multiple filters are \
specified, they are applied in the order in which they are specified. Each filter is applied \
to each issue detected, and only issues which are accepted by all filters are reported. Each \
filter is of the form: `<issue_type_regex>:<filename_regex>:<reason_string>`. The first two \
components are OCaml Str regular expressions, with an optional `!` character prefix. If a \
regex has a `!` prefix, the polarity is inverted, and the filter becomes a \"blacklist\" \
instead of a \"whitelist\". Each filter is interpreted as an implication: an issue matches \
if it does not match the `issue_type_regex` or if it does match the `filename_regex`. The \
filenames that are tested by the regex are relative to the `--project-root` directory. The \
`<reason_string>` is a non-empty string used to explain why the issue was filtered."
and changed_files_index =
CLOpt.mk_path_opt ~long:"changed-files-index"
~in_help:InferCommand.[(Analyze, manual_generic); (Diff, manual_generic)]
@ -1401,21 +1418,6 @@ and filter_paths =
CLOpt.mk_bool ~long:"filter-paths" ~default:true "Filters specified in .inferconfig"
and filter_report =
CLOpt.mk_string_list ~long:"filter-report"
~in_help:InferCommand.[(Report, manual_generic); (Run, manual_generic)]
"Specify a filter for issues to report. If multiple filters are specified, they are applied \
in the order in which they are specified. Each filter is applied to each issue detected, and \
only issues which are accepted by all filters are reported. Each filter is of the form: \
`<issue_type_regex>:<filename_regex>:<reason_string>`. The first two components are OCaml \
Str regular expressions, with an optional `!` character prefix. If a regex has a `!` prefix, \
the polarity is inverted, and the filter becomes a \"blacklist\" instead of a \"whitelist\". \
Each filter is interpreted as an implication: an issue matches if it does not match the \
`issue_type_regex` or if it does match the `filename_regex`. The filenames that are tested \
by the regex are relative to the `--project-root` directory. The `<reason_string>` is a \
non-empty string used to explain why the issue was filtered."
and flavors =
CLOpt.mk_bool ~deprecated:["-use-flavors"] ~long:"flavors"
~in_help:InferCommand.[(Capture, manual_buck_flavors)]
@ -2731,6 +2733,21 @@ and capture =
and capture_blacklist = !capture_blacklist
and censor_report =
List.map !censor_report ~f:(fun str ->
match String.split str ~on:':' with
| [issue_type_re; filename_re; reason_str]
when not String.(is_empty issue_type_re || is_empty filename_re || is_empty reason_str) ->
let polarity_regex re =
let polarity = not (Char.equal '!' re.[0]) in
let regex = Str.regexp (if polarity then re else String.slice re 1 0) in
(polarity, regex)
in
(polarity_regex issue_type_re, polarity_regex filename_re, reason_str)
| _ ->
L.(die UserError) "Ill-formed report filter: %s" str )
and changed_files_index = !changed_files_index
and nullsafe = !nullsafe
@ -2827,21 +2844,6 @@ and file_renamings = !file_renamings
and filter_paths = !filter_paths
and filter_report =
List.map !filter_report ~f:(fun str ->
match String.split str ~on:':' with
| [issue_type_re; filename_re; reason_str]
when not String.(is_empty issue_type_re || is_empty filename_re || is_empty reason_str) ->
let polarity_regex re =
let polarity = not (Char.equal '!' re.[0]) in
let regex = Str.regexp (if polarity then re else String.slice re 1 0) in
(polarity, regex)
in
(polarity_regex issue_type_re, polarity_regex filename_re, reason_str)
| _ ->
L.(die UserError) "Ill-formed report filter: %s" str )
and filtering = !filtering
and flavors = !flavors

@ -268,6 +268,8 @@ val capture_blacklist : string option
val captured_dir : string
(** directory where the results of the capture phase are stored *)
val censor_report : ((bool * Str.regexp) * (bool * Str.regexp) * string) list
val changed_files_index : string option
val check_version : string option
@ -364,8 +366,6 @@ val file_renamings : string option
val filter_paths : bool
val filter_report : ((bool * Str.regexp) * (bool * Str.regexp) * string) list
val filtering : bool
val flavors : bool

Loading…
Cancel
Save