Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types to return the languages for which we tried to run the pro engine #189

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions semgrep_metrics.atd
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,6 @@ type misc = {
?ruleHashesWithFindings <ocaml mutable>: (string * int) list <json repr="object"> option;
(* TODO: should be OSS | Pro, see semgrep_output_v1.atd engine_kind type *)
~engineRequested <python default="'OSS'"> <ocaml mutable>: string;
(* Since Semgrep 1.49.0 *)
?interfileLanguagesUsed: string list option;
}
4 changes: 4 additions & 0 deletions semgrep_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class Misc:
numIgnored: Optional[int] = None
ruleHashesWithFindings: Optional[List[Tuple[str, int]]] = None
engineRequested: str = field(default_factory=lambda: 'OSS')
interfileLanguagesUsed: Optional[List[str]] = None

@classmethod
def from_json(cls, x: Any) -> 'Misc':
Expand All @@ -523,6 +524,7 @@ def from_json(cls, x: Any) -> 'Misc':
numIgnored=_atd_read_int(x['numIgnored']) if 'numIgnored' in x else None,
ruleHashesWithFindings=_atd_read_assoc_object_into_list(_atd_read_int)(x['ruleHashesWithFindings']) if 'ruleHashesWithFindings' in x else None,
engineRequested=_atd_read_string(x['engineRequested']) if 'engineRequested' in x else 'OSS',
interfileLanguagesUsed=_atd_read_list(_atd_read_string)(x['interfileLanguagesUsed']) if 'interfileLanguagesUsed' in x else None,
)
else:
_atd_bad_json('Misc', x)
Expand All @@ -539,6 +541,8 @@ def to_json(self) -> Any:
if self.ruleHashesWithFindings is not None:
res['ruleHashesWithFindings'] = _atd_write_assoc_list_to_object(_atd_write_int)(self.ruleHashesWithFindings)
res['engineRequested'] = _atd_write_string(self.engineRequested)
if self.interfileLanguagesUsed is not None:
res['interfileLanguagesUsed'] = _atd_write_list(_atd_write_string)(self.interfileLanguagesUsed)
return res

@classmethod
Expand Down
6 changes: 6 additions & 0 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,12 @@ type cli_output_extra = {
?rules_by_engine: rule_id_and_engine_kind list option;
?engine_requested: engine_kind option;

(* Reporting just the requested engine isn't granular enough. We want to know
what languages had rules that invoked interfile. This is particularly important
for tracking the performance impact of new interfile languages *)
(* EXPERIMENTAL: since 1.49.0 *)
?interfile_languages_used: string list option;

(* EXPERIMENTAL: since: 1.37.0 *)
~skipped_rules: skipped_rule list;
}
Expand Down
12 changes: 12 additions & 0 deletions semgrep_output_v1.jsonschema

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion semgrep_output_v1.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions semgrep_output_v1.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions semgrep_output_v1.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading