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

Add format_context and complete output_format for RPC call to format #310

Merged
merged 1 commit into from
Nov 6, 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
47 changes: 42 additions & 5 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,10 @@ type ci_env = (string * string) list

(* See src/rpc/README.txt in the Semgrep repository. *)

(* ----------------------------- *)
(* argument call types *)
(* ----------------------------- *)

(* coupling: Textedit.ml *)
type edit
<python decorator="dataclass(frozen=True)"> = {
Expand Down Expand Up @@ -1821,11 +1825,32 @@ type sarif_format_return
format_time_seconds: float;
}

(* TODO: merge with src/osemgrep/reporting/Output_format.ml *)
type output_format = [
| Vim
type output_format
<ocaml attr="deriving show">
<python decorator="dataclass(frozen=True)"> = [
| Text
| Json
| Emacs
]
| Vim
| Sarif
| Gitlab_sast
| Gitlab_secrets
| Junit_xml
(* osemgrep-only *)
| Files_with_matches
(* used to disable the final display of match results because
* we displayed them incrementally instead
*)
| Incremental
] <ocaml repr="classic">

type format_context
<ocaml attr="deriving show">
<python decorator="dataclass(frozen=True)"> = {
is_ci_invocation: bool;
is_logged_in: bool;
is_using_registry: bool;
}

type manifest_kind
<ocaml attr="deriving show, eq, yojson">
Expand Down Expand Up @@ -1891,12 +1916,16 @@ type dump_rule_partitions_params = {
output_dir: fpath;
}

(* ----------------------------- *)
(* The call *)
(* ----------------------------- *)

type function_call
<python decorator="dataclass(frozen=True)"> = [
| CallContributions
| CallApplyFixes of apply_fixes_params
| CallSarifFormat of sarif_format_params
| CallFormatter of (output_format * cli_output)
| 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
the RPC pipe.
Expand All @@ -1906,6 +1935,10 @@ type function_call
| CallDumpRulePartitions of dump_rule_partitions_params
]

(* ----------------------------- *)
(* The return *)
(* ----------------------------- *)

type function_return
<python decorator="dataclass(frozen=True)"> = [
| RetError of string
Expand All @@ -1918,6 +1951,10 @@ type function_return
| RetDumpRulePartitions of bool
]

(*****************************************************************************)
(* Misc *)
(*****************************************************************************)

(* ----------------------------- *)
(* Partial scans. Experimental and for internal use only. *)
(* ----------------------------- *)
Expand Down
25 changes: 23 additions & 2 deletions semgrep_output_v1.jsonschema

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

8 changes: 7 additions & 1 deletion semgrep_output_v1.proto

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

Loading
Loading