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

Pass format_context also to RPC CallSarifFormat #318

Merged
merged 2 commits into from
Dec 11, 2024
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
34 changes: 14 additions & 20 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -1937,32 +1937,24 @@ type apply_fixes_return <python decorator="dataclass(frozen=True)"> = {
fixed_lines: (int * string list) list;
}

(* TODO: remove many fields so that CallSarifFormat gets close to CallFormatter.
* I think we just need the 'rules: fpath' as it can't be reconstructed
* from cli_output.
*)
type sarif_format_params <python decorator="dataclass(frozen=True)"> = {
hide_nudge: bool;
engine_label: string;

(* Path the the rules file *)
rules: fpath;

(* Semgrep-core matches along with their match based ids,
* which are needed here because the ocaml implementation
* of fingerprints currently doesn't match python yet.
*)
(* TODO: remove, just use cli_output *)
cli_matches: cli_match list;

(* We use cli_error instead of core_error because it has
* extra info from the python side that cannot be fully
* recovered cleanly on the ocaml side just by the available
* info in core_error.
*)
cli_errors: cli_error list;

(* This field was added later and had to be optional to make it
* backward-compatible and pass PR checks.
*)
?show_dataflow_traces: bool option;
(* TODO: remove, should be able to derive those from format_context *)
hide_nudge: bool;
engine_label: string;
show_dataflow_traces: bool;
}

(* TODO: remove, reuse RetFormatter *)
type sarif_format_return <python decorator="dataclass(frozen=True)"> = {
(* The formatted output. *)
output: string;
Expand Down Expand Up @@ -2151,7 +2143,8 @@ type resolution_result = [
type function_call <python decorator="dataclass(frozen=True)"> = [
| CallContributions
| CallApplyFixes of apply_fixes_params
| CallSarifFormat of sarif_format_params
(* TODO: merge with CallFormatter at some point *)
| CallSarifFormat of (format_context * sarif_format_params)
| CallFormatter of (output_format * format_context * cli_output)
(* NOTE: fpath is most likely a temporary file that contains all the rules in
JSON format. In the future, we could send the rules via a big string through
Expand All @@ -2169,8 +2162,9 @@ type function_call <python decorator="dataclass(frozen=True)"> = [
type function_return <python decorator="dataclass(frozen=True)"> = [
| RetError of string
| RetApplyFixes of apply_fixes_return
| RetSarifFormat of sarif_format_return
| RetContributions of contributions
(* TODO: remove and use RetFormatter for the return of CallSarifFormat too *)
| RetSarifFormat of sarif_format_return
| RetFormatter of string
| RetValidate of bool
| RetResolveDependencies of (dependency_source * resolution_result) list
Expand Down
25 changes: 17 additions & 8 deletions semgrep_output_v1.jsonschema

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

6 changes: 3 additions & 3 deletions semgrep_output_v1.proto

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

51 changes: 25 additions & 26 deletions semgrep_output_v1.py

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

34 changes: 17 additions & 17 deletions semgrep_output_v1.ts

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

Loading
Loading