Skip to content

Commit 3ccacb1

Browse files
mityalfacebook-github-bot
authored andcommitted
[nullsafe] Add nullsafe extras for meta-issues
Summary: This information can be useful for tooling responsible for further processing (e.g. metric calculation and logging) Reviewed By: artempyanykh Differential Revision: D20914583 fbshipit-source-id: 61804d88f
1 parent 2eae5ff commit 3ccacb1

File tree

13 files changed

+215
-143
lines changed

13 files changed

+215
-143
lines changed

infer/man/man1/infer-full.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ OPTIONS
673673
--issues-tests-fields ,-separated sequence of { bug_type | bucket |
674674
qualifier | severity | line | column | procedure |
675675
procedure_start_line | file | bug_trace | key | hash | line_offset |
676-
qualifier_contains_potential_exception_note }
676+
qualifier_contains_potential_exception_note | nullsafe_extra }
677677
Fields to emit with --issues-tests See also infer-report(1).
678678

679679
--java-jar-compiler path

infer/man/man1/infer-report.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ OPTIONS
282282
--issues-tests-fields ,-separated sequence of { bug_type | bucket |
283283
qualifier | severity | line | column | procedure |
284284
procedure_start_line | file | bug_trace | key | hash | line_offset |
285-
qualifier_contains_potential_exception_note }
285+
qualifier_contains_potential_exception_note | nullsafe_extra }
286286
Fields to emit with --issues-tests
287287

288288
--print-logs

infer/man/man1/infer.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ OPTIONS
673673
--issues-tests-fields ,-separated sequence of { bug_type | bucket |
674674
qualifier | severity | line | column | procedure |
675675
procedure_start_line | file | bug_trace | key | hash | line_offset |
676-
qualifier_contains_potential_exception_note }
676+
qualifier_contains_potential_exception_note | nullsafe_extra }
677677
Fields to emit with --issues-tests See also infer-report(1).
678678

679679
--java-jar-compiler path

infer/src/atd/jsonbug.atd

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ type loc = {
2020
enum: int;
2121
}
2222

23+
type nullsafe_mode = [Default | LocalTrustAll | LocalTrustSome | LocalTrustNone | Strict]
24+
25+
type nullsafe_meta_issue_info = {
26+
num_issues: int;
27+
curr_nullsafe_mode: nullsafe_mode;
28+
}
29+
30+
type nullsafe_extra = {
31+
class_name: string;
32+
package: string option;
33+
?meta_issue_info: nullsafe_meta_issue_info option (* Should be present if the issue is "nullsafe meta issue" *)
34+
}
35+
2336
type extra = {
2437
?cost_polynomial : string option;
25-
?cost_degree : int option
38+
?cost_degree : int option;
39+
?nullsafe_extra : nullsafe_extra option
2640
}
2741

2842
type jsonbug = {

infer/src/backend/reporting.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ let log_error = log_issue_from_summary_simplified Exceptions.Error
8686

8787
let log_warning = log_issue_from_summary_simplified Exceptions.Warning
8888

89-
let log_issue_external procname ~issue_log severity ~loc ~ltr ?access issue_type error_message =
89+
let log_issue_external procname ~issue_log severity ~loc ~ltr ?access ?extras issue_type
90+
error_message =
9091
let exn = checker_exception issue_type error_message in
9192
let issue_log, errlog = IssueLog.get_or_add issue_log ~proc:procname in
9293
let node = Errlog.UnknownNode in
93-
log_issue_from_errlog severity errlog ~loc ~node ~session:0 ~ltr ~access ~extras:None exn ;
94+
log_issue_from_errlog severity errlog ~loc ~node ~session:0 ~ltr ~access ~extras exn ;
9495
issue_log
9596

9697

infer/src/backend/reporting.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ val log_issue_external :
4848
-> loc:Location.t
4949
-> ltr:Errlog.loc_trace
5050
-> ?access:string
51+
-> ?extras:Jsonbug_t.extra
5152
-> IssueType.t
5253
-> string
5354
-> IssueLog.t

infer/src/base/Config.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,9 @@ and iphoneos_target_sdk_version_path_regex =
14351435
and issues_tests_fields =
14361436
CLOpt.mk_symbol_seq ~long:"issues-tests-fields"
14371437
~in_help:InferCommand.[(Report, manual_generic)]
1438-
~default:IssuesTestField.[File; Procedure; LineOffset; BugType; Bucket; Severity; BugTrace]
1438+
~default:
1439+
IssuesTestField.
1440+
[File; Procedure; LineOffset; BugType; Bucket; Severity; BugTrace; NullsafeExtra]
14391441
~symbols:IssuesTestField.all_symbols ~eq:IssuesTestField.equal
14401442
"Fields to emit with $(b,--issues-tests)"
14411443

infer/src/base/IssuesTestField.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type t =
2222
| Hash
2323
| LineOffset
2424
| QualifierContainsPotentialExceptionNote
25+
| NullsafeExtra
2526
[@@deriving equal]
2627

2728
let all_symbols =
@@ -38,4 +39,5 @@ let all_symbols =
3839
; ("key", Key)
3940
; ("hash", Hash)
4041
; ("line_offset", LineOffset)
41-
; ("qualifier_contains_potential_exception_note", QualifierContainsPotentialExceptionNote) ]
42+
; ("qualifier_contains_potential_exception_note", QualifierContainsPotentialExceptionNote)
43+
; ("nullsafe_extra", NullsafeExtra) ]

infer/src/base/IssuesTestField.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type t =
2222
| Hash
2323
| LineOffset
2424
| QualifierContainsPotentialExceptionNote
25+
| NullsafeExtra
2526
[@@deriving equal]
2627

2728
val all_symbols : (string * t) list

infer/src/cost/cost.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ end
150150

151151
let compute_errlog_extras cost =
152152
{ Jsonbug_t.cost_polynomial= Some (Format.asprintf "%a" BasicCost.pp_hum cost)
153-
; cost_degree= BasicCost.degree cost |> Option.map ~f:Polynomials.Degree.encode_to_int }
153+
; cost_degree= BasicCost.degree cost |> Option.map ~f:Polynomials.Degree.encode_to_int
154+
; nullsafe_extra= None }
154155

155156

156157
module ThresholdReports = struct

0 commit comments

Comments
 (0)