Skip to content

Commit d4dd97a

Browse files
committed
Add a metric to record how many interface fields are resolved
1 parent bc03844 commit d4dd97a

9 files changed

+210
-10
lines changed

semgrep_metrics.atd

+9
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,22 @@ type pro_features = {
204204
* Since semgrep 1.46
205205
*)
206206
?diffDepth <ocaml mutable>: int option;
207+
207208
(* The number of scanned files per language for inter-file diff scan mode.
208209
* This number represents the count of changed files and their limited
209210
* dependencies.
210211
* Since semgrep 1.70
211212
*)
212213
?numInterfileDiffScanned <ocaml mutable>: (string (* lang *) * int) list
213214
<json repr="object"> option;
215+
216+
(* The number of interface fields resolved during the Naming_SAST phases.
217+
* This is the total count from the naming resolution of all field accesses
218+
* in the input source code.
219+
* Since semgrep 1.91
220+
*)
221+
?numInterfaceVarResolved <ocaml mutable>: int option;
222+
?numInterfaceMethodResolved <ocaml mutable>: int option;
214223
}
215224

216225
(* Since v1.55.0 *)

semgrep_metrics.py

+8
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,17 @@ class ProFeatures:
411411

412412
diffDepth: Optional[int] = None
413413
numInterfileDiffScanned: Optional[List[Tuple[str, int]]] = None
414+
numInterfaceVarResolved: Optional[int] = None
415+
numInterfaceMethodResolved: Optional[int] = None
414416

415417
@classmethod
416418
def from_json(cls, x: Any) -> 'ProFeatures':
417419
if isinstance(x, dict):
418420
return cls(
419421
diffDepth=_atd_read_int(x['diffDepth']) if 'diffDepth' in x else None,
420422
numInterfileDiffScanned=_atd_read_assoc_object_into_list(_atd_read_int)(x['numInterfileDiffScanned']) if 'numInterfileDiffScanned' in x else None,
423+
numInterfaceVarResolved=_atd_read_int(x['numInterfaceVarResolved']) if 'numInterfaceVarResolved' in x else None,
424+
numInterfaceMethodResolved=_atd_read_int(x['numInterfaceMethodResolved']) if 'numInterfaceMethodResolved' in x else None,
421425
)
422426
else:
423427
_atd_bad_json('ProFeatures', x)
@@ -428,6 +432,10 @@ def to_json(self) -> Any:
428432
res['diffDepth'] = _atd_write_int(self.diffDepth)
429433
if self.numInterfileDiffScanned is not None:
430434
res['numInterfileDiffScanned'] = _atd_write_assoc_list_to_object(_atd_write_int)(self.numInterfileDiffScanned)
435+
if self.numInterfaceVarResolved is not None:
436+
res['numInterfaceVarResolved'] = _atd_write_int(self.numInterfaceVarResolved)
437+
if self.numInterfaceMethodResolved is not None:
438+
res['numInterfaceMethodResolved'] = _atd_write_int(self.numInterfaceMethodResolved)
431439
return res
432440

433441
@classmethod

semgrep_output_v1.atd

+3
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,9 @@ type cli_output_extra = {
868868

869869
(* EXPERIMENTAL: since: 1.37.0 *)
870870
~skipped_rules: skipped_rule list;
871+
872+
(* EXPERIMENTAL: since: 1.91.0 *)
873+
?extra_extra: raw_json option;
871874
}
872875

873876
(*****************************************************************************)

semgrep_output_v1.jsonschema

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)