[reporting] Don't secretly hide `Info` issues

Summary:
It is true that `Info` issues are normally not intended for the end user
and in general should be hidden by default.
However, the current behavior - show them only if `--no-filtering` is
true - is super non-intuitive and complicates already complex reporting
logic.

Lets use the general "enable/disable" mechanism for controlling this.

Reviewed By: jvillard

Differential Revision: D21154140

fbshipit-source-id: 69e4c88e4
master
Mitya Lyubarskiy 5 years ago committed by Facebook GitHub Bot
parent 53822697f9
commit a7e8bb5f4d

@ -378,7 +378,7 @@ OPTIONS
COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPARING_FLOAT_FOR_EQUALITY (enabled by default),
COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default),
COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default),
COMPONENT_FILE_LINE_COUNT (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default),
COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default), COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default),
COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default), COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default),
COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default), COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default),
@ -483,8 +483,8 @@ OPTIONS
RETURN_VALUE_IGNORED (disabled by default), RETURN_VALUE_IGNORED (disabled by default),
SHELL_INJECTION (enabled by default), SHELL_INJECTION (enabled by default),
SHELL_INJECTION_RISK (enabled by default), SHELL_INJECTION_RISK (enabled by default),
SKIP_FUNCTION (enabled by default), SKIP_FUNCTION (disabled by default),
SKIP_POINTER_DEREFERENCE (enabled by default), SKIP_POINTER_DEREFERENCE (disabled by default),
SQL_INJECTION (enabled by default), SQL_INJECTION (enabled by default),
SQL_INJECTION_RISK (enabled by default), SQL_INJECTION_RISK (enabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default),

@ -108,7 +108,7 @@ OPTIONS
COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPARING_FLOAT_FOR_EQUALITY (enabled by default),
COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default),
COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default),
COMPONENT_FILE_LINE_COUNT (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default),
COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default), COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default),
COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default), COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default),
COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default), COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default),
@ -213,8 +213,8 @@ OPTIONS
RETURN_VALUE_IGNORED (disabled by default), RETURN_VALUE_IGNORED (disabled by default),
SHELL_INJECTION (enabled by default), SHELL_INJECTION (enabled by default),
SHELL_INJECTION_RISK (enabled by default), SHELL_INJECTION_RISK (enabled by default),
SKIP_FUNCTION (enabled by default), SKIP_FUNCTION (disabled by default),
SKIP_POINTER_DEREFERENCE (enabled by default), SKIP_POINTER_DEREFERENCE (disabled by default),
SQL_INJECTION (enabled by default), SQL_INJECTION (enabled by default),
SQL_INJECTION_RISK (enabled by default), SQL_INJECTION_RISK (enabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default),

@ -378,7 +378,7 @@ OPTIONS
COMPARING_FLOAT_FOR_EQUALITY (enabled by default), COMPARING_FLOAT_FOR_EQUALITY (enabled by default),
COMPONENT_FACTORY_FUNCTION (enabled by default), COMPONENT_FACTORY_FUNCTION (enabled by default),
COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default), COMPONENT_FILE_CYCLOMATIC_COMPLEXITY (enabled by default),
COMPONENT_FILE_LINE_COUNT (enabled by default), COMPONENT_FILE_LINE_COUNT (disabled by default),
COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default), COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS (enabled by default),
COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default), COMPONENT_WITH_MULTIPLE_FACTORY_METHODS (enabled by default),
COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default), COMPONENT_WITH_UNCONVENTIONAL_SUPERCLASS (enabled by default),
@ -483,8 +483,8 @@ OPTIONS
RETURN_VALUE_IGNORED (disabled by default), RETURN_VALUE_IGNORED (disabled by default),
SHELL_INJECTION (enabled by default), SHELL_INJECTION (enabled by default),
SHELL_INJECTION_RISK (enabled by default), SHELL_INJECTION_RISK (enabled by default),
SKIP_FUNCTION (enabled by default), SKIP_FUNCTION (disabled by default),
SKIP_POINTER_DEREFERENCE (enabled by default), SKIP_POINTER_DEREFERENCE (disabled by default),
SQL_INJECTION (enabled by default), SQL_INJECTION (enabled by default),
SQL_INJECTION_RISK (enabled by default), SQL_INJECTION_RISK (enabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default), STACK_VARIABLE_ADDRESS_ESCAPE (disabled by default),

@ -184,7 +184,7 @@ let component_file_cyclomatic_complexity =
register_from_string "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY" register_from_string "COMPONENT_FILE_CYCLOMATIC_COMPLEXITY"
let component_file_line_count = register_from_string "COMPONENT_FILE_LINE_COUNT" let component_file_line_count = register_from_string ~enabled:false "COMPONENT_FILE_LINE_COUNT"
let component_initializer_with_side_effects = let component_initializer_with_side_effects =
register_from_string "COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS" register_from_string "COMPONENT_INITIALIZER_WITH_SIDE_EFFECTS"
@ -297,7 +297,7 @@ let eradicate_meta_class_is_nullsafe =
~enabled:false ~enabled:false
(* Class is either: (* Class is either:
- has at least one nullability issue. - has at least one nullability issue.
- has at least one (currently possibly hidden) issue in order to be marked as @Nullsafe. - has at least one (currently possibly hidden) issue in order to be marked as @Nullsafe.
*) *)
@ -436,9 +436,9 @@ let return_statement_missing = register_from_string "RETURN_STATEMENT_MISSING"
let return_value_ignored = register_from_string ~enabled:false "RETURN_VALUE_IGNORED" let return_value_ignored = register_from_string ~enabled:false "RETURN_VALUE_IGNORED"
let skip_function = register_from_string "SKIP_FUNCTION" let skip_function = register_from_string ~enabled:false "SKIP_FUNCTION"
let skip_pointer_dereference = register_from_string "SKIP_POINTER_DEREFERENCE" let skip_pointer_dereference = register_from_string ~enabled:false "SKIP_POINTER_DEREFERENCE"
let shell_injection = register_from_string "SHELL_INJECTION" let shell_injection = register_from_string "SHELL_INJECTION"

@ -59,27 +59,22 @@ let loc_trace_to_jsonbug_record trace_list ekind =
record_list record_list
let should_report (issue_kind : Exceptions.severity) issue_type error_desc eclass = let should_report issue_type error_desc eclass =
if (not Config.filtering) || Exceptions.equal_err_class eclass Exceptions.Linters then true if (not Config.filtering) || Exceptions.equal_err_class eclass Exceptions.Linters then true
else else
let issue_kind_is_blacklisted = let issue_type_is_null_deref =
match issue_kind with Info -> true | Advice | Error | Like | Warning -> false let null_deref_issue_types =
in let open IssueType in
if issue_kind_is_blacklisted then false [ field_not_null_checked
else ; null_dereference
let issue_type_is_null_deref = ; parameter_not_null_checked
let null_deref_issue_types = ; premature_nil_termination
let open IssueType in ; empty_vector_access
[ field_not_null_checked ; biabd_use_after_free ]
; null_dereference
; parameter_not_null_checked
; premature_nil_termination
; empty_vector_access
; biabd_use_after_free ]
in
List.mem ~equal:IssueType.equal null_deref_issue_types issue_type
in in
if issue_type_is_null_deref then Localise.error_desc_is_reportable_bucket error_desc else true List.mem ~equal:IssueType.equal null_deref_issue_types issue_type
in
if issue_type_is_null_deref then Localise.error_desc_is_reportable_bucket error_desc else true
(* The reason an issue should be censored (that is, not reported). The empty (* The reason an issue should be censored (that is, not reported). The empty
@ -171,7 +166,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
if if
error_filter source_file err_key.err_name error_filter source_file err_key.err_name
&& should_report_source_file && should_report_source_file
&& should_report err_key.severity err_key.err_name err_key.err_desc err_data.err_class && should_report err_key.err_name err_key.err_desc err_data.err_class
then then
let severity = Exceptions.severity_string err_key.severity in let severity = Exceptions.severity_string err_key.severity in
let bug_type = err_key.err_name.IssueType.unique_id in let bug_type = err_key.err_name.IssueType.unique_id in

Loading…
Cancel
Save