[infer] remove the "kind" field from the analysis report

Summary: This field was now redundant with the "severity" field

Reviewed By: mbouaziz

Differential Revision: D9553101

fbshipit-source-id: 69b7c9d1c
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent 56612796e6
commit 35eba40452

@ -24,11 +24,11 @@ except ImportError:
from . import colorize, config, source, utils
ISSUE_KIND_ERROR = 'ERROR'
ISSUE_KIND_WARNING = 'WARNING'
ISSUE_KIND_INFO = 'INFO'
ISSUE_KIND_ADVICE = 'ADVICE'
ISSUE_KIND_LIKE = 'LIKE'
ISSUE_SEVERITY_ERROR = 'ERROR'
ISSUE_SEVERITY_WARNING = 'WARNING'
ISSUE_SEVERITY_INFO = 'INFO'
ISSUE_SEVERITY_ADVICE = 'ADVICE'
ISSUE_SEVERITY_LIKE = 'LIKE'
# field names in rows of json reports
JSON_INDEX_DOTTY = 'dotty'
@ -39,7 +39,7 @@ JSON_INDEX_ISL_FILE = 'file'
JSON_INDEX_ISL_LNUM = 'lnum'
JSON_INDEX_ISL_CNUM = 'cnum'
JSON_INDEX_ISL_ENUM = 'enum'
JSON_INDEX_KIND = 'kind'
JSON_INDEX_SEVERITY = 'severity'
JSON_INDEX_LINE = 'line'
JSON_INDEX_PROCEDURE = 'procedure'
JSON_INDEX_QUALIFIER = 'qualifier'
@ -69,7 +69,7 @@ def text_of_infer_loc(loc):
def text_of_report(report):
filename = report[JSON_INDEX_FILENAME]
kind = report[JSON_INDEX_KIND]
severity = report[JSON_INDEX_SEVERITY]
line = report[JSON_INDEX_LINE]
error_type = report[JSON_INDEX_TYPE]
msg = report[JSON_INDEX_QUALIFIER]
@ -79,7 +79,7 @@ def text_of_report(report):
return '%s:%d: %s: %s%s\n %s' % (
filename,
line,
kind.lower(),
severity.lower(),
error_type,
infer_loc,
msg,
@ -118,13 +118,13 @@ def _text_of_report_list(project_root, reports, bugs_txt_path, limit=None,
source_context = '\n' + unicode(indenter)
msg = text_of_report(report)
if report[JSON_INDEX_KIND] == ISSUE_KIND_ERROR:
if report[JSON_INDEX_SEVERITY] == ISSUE_SEVERITY_ERROR:
msg = colorize.color(msg, colorize.ERROR, formatter)
elif report[JSON_INDEX_KIND] == ISSUE_KIND_WARNING:
elif report[JSON_INDEX_SEVERITY] == ISSUE_SEVERITY_WARNING:
msg = colorize.color(msg, colorize.WARNING, formatter)
elif report[JSON_INDEX_KIND] == ISSUE_KIND_ADVICE:
elif report[JSON_INDEX_SEVERITY] == ISSUE_SEVERITY_ADVICE:
msg = colorize.color(msg, colorize.ADVICE, formatter)
elif report[JSON_INDEX_KIND] == ISSUE_KIND_LIKE:
elif report[JSON_INDEX_SEVERITY] == ISSUE_SEVERITY_LIKE:
msg = colorize.color(msg, colorize.LIKE, formatter)
text = '%s%s' % (msg, source_context)
text_errors_list.append(text)
@ -179,12 +179,11 @@ def _text_of_report_list(project_root, reports, bugs_txt_path, limit=None,
def _is_user_visible(report):
kind = report[JSON_INDEX_KIND]
return kind in [
ISSUE_KIND_ERROR,
ISSUE_KIND_WARNING,
ISSUE_KIND_ADVICE,
ISSUE_KIND_LIKE]
return report[JSON_INDEX_SEVERITY] in [
ISSUE_SEVERITY_ERROR,
ISSUE_SEVERITY_WARNING,
ISSUE_SEVERITY_ADVICE,
ISSUE_SEVERITY_LIKE]
def print_and_save_errors(infer_out, project_root, json_report, bugs_out,

@ -19,7 +19,6 @@ type extra = {
}
type jsonbug = {
kind : string;
bug_type : string;
?doc_url : string option;
qualifier : string;

@ -302,8 +302,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
Typ.Procname.to_string proc_name
in
let bug =
{ Jsonbug_j.kind= severity
; bug_type
{ Jsonbug_j.bug_type
; qualifier
; severity
; visibility
@ -376,8 +375,6 @@ let pp_custom_of_report fmt report fields =
in
let pp_field index field =
match field with
| `Issue_field_kind ->
Format.fprintf fmt "%s%s" (comma_separator index) issue.kind
| `Issue_field_bug_type ->
Format.fprintf fmt "%s%s" (comma_separator index) issue.bug_type
| `Issue_field_bucket ->
@ -458,7 +455,7 @@ end
let pp_text_of_report fmt report =
let pp_row jsonbug =
let open Jsonbug_t in
F.fprintf fmt "%s:%d: %s: %s %s@\n" jsonbug.file jsonbug.line jsonbug.kind jsonbug.bug_type
F.fprintf fmt "%s:%d: %s: %s %s@\n" jsonbug.file jsonbug.line jsonbug.severity jsonbug.bug_type
jsonbug.qualifier
in
List.iter ~f:pp_row report ; F.fprintf fmt "@?"

@ -48,8 +48,7 @@ let ml_bucket_symbols =
let issues_fields_symbols =
[ ("kind", `Issue_field_kind)
; ("bug_type", `Issue_field_bug_type)
[ ("bug_type", `Issue_field_bug_type)
; ("bucket", `Issue_field_bucket)
; ("qualifier", `Issue_field_qualifier)
; ("severity", `Issue_field_severity)
@ -1458,7 +1457,7 @@ and issues_fields =
; `Issue_field_line_offset
; `Issue_field_bug_type
; `Issue_field_bucket
; `Issue_field_kind
; `Issue_field_severity
; `Issue_field_bug_trace ]
~symbols:issues_fields_symbols ~eq:PolyVariantEqual.( = )
"Fields to emit with $(b,--issues-tests)"

@ -400,8 +400,7 @@ type iphoneos_target_sdk_version_path_regex = {path: Str.regexp; version: string
val iphoneos_target_sdk_version_path_regex : iphoneos_target_sdk_version_path_regex list
val issues_fields :
[ `Issue_field_kind
| `Issue_field_bug_type
[ `Issue_field_bug_type
| `Issue_field_qualifier
| `Issue_field_severity
| `Issue_field_bucket

@ -7,14 +7,13 @@
open! IStd
let create_fake_jsonbug ?(kind = "kind") ?(bug_type = "bug_type") ?(qualifier = "qualifier")
let create_fake_jsonbug ?(bug_type = "bug_type") ?(qualifier = "qualifier")
?(severity = "severity") ?(visibility = "visibility") ?(line = 1) ?(column = 1)
?(procedure = "procedure") ?(procedure_start_line = 1) ?(file = "file/at/a/certain/path.java")
?(bug_trace = []) ?(key = "File|method|TYPE") ?(node_key = Some "1234") ?(hash = "1")
?(dotty = None) ?(infer_source_loc = None) ?(linters_def_file = Some "file/at/certain/path.al")
?doc_url () : Jsonbug_t.jsonbug =
{ kind
; bug_type
{ bug_type
; qualifier
; severity
; visibility
@ -29,7 +28,7 @@ let create_fake_jsonbug ?(kind = "kind") ?(bug_type = "bug_type") ?(qualifier =
; hash
; dotty
; infer_source_loc
; bug_type_hum= kind
; bug_type_hum= bug_type
; linters_def_file
; doc_url
; traceview_id= None

Loading…
Cancel
Save