Skip to content

Commit

Permalink
add rpc interface for dump rule partitions (#293)
Browse files Browse the repository at this point in the history
Closes [SMS-498](https://linear.app/semgrep/issue/SMS-498). Context is
in the ticket.

- [x] I ran `make setup && make` to update the generated code after
editing a `.atd` file (TODO: have a CI check)
- [x] I made sure we're still backward compatible with old versions of
the CLI.
For example, the Semgrep backend need to still be able to *consume* data
generated
	  by Semgrep 1.17.0.
See
https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades
  • Loading branch information
amchiclet authored Sep 24, 2024
1 parent bc03844 commit 724cfcc
Show file tree
Hide file tree
Showing 7 changed files with 432 additions and 5 deletions.
11 changes: 9 additions & 2 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ type sarif_format_return
* performace when needed.
*)
format_time_seconds: float;
}
}

(* TODO: merge with src/osemgrep/reporting/Output_format.ml *)
type output_format = [
Expand All @@ -1820,7 +1820,6 @@ type manifest = {
path: fpath;
}


type resolution_error
<python decorator="dataclass(frozen=True)"> = [
| UnsupportedManifest
Expand All @@ -1842,6 +1841,12 @@ type resolution_result = [
| ResolutionError of resolution_error
]

type dump_rule_partitions_params = {
rules: raw_json;
n_partitions: int;
output_dir: fpath;
}

type function_call
<python decorator="dataclass(frozen=True)"> = [
| CallContributions
Expand All @@ -1854,6 +1859,7 @@ type function_call
*)
| CallValidate of fpath
| CallResolveDependencies of manifest list
| CallDumpRulePartitions of dump_rule_partitions_params
]

type function_return
Expand All @@ -1865,4 +1871,5 @@ type function_return
| RetFormatter of string
| RetValidate of bool
| RetResolveDependencies of (manifest * resolution_result) list
| RetDumpRulePartitions of bool
]
26 changes: 26 additions & 0 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.

78 changes: 76 additions & 2 deletions semgrep_output_v1.py

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

32 changes: 32 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

0 comments on commit 724cfcc

Please sign in to comment.