Skip to content

Commit 74bee1e

Browse files
authored
chore(sca): add rpc to match subprojects (#364)
Adds an RPC type that allows Python to ask Ocaml to match subprojects based on a list of dependency source files. This will allow us to switch to ocaml-based subproject matching independently from the rest of file targeting. - [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.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible!
1 parent 6edf9cf commit 74bee1e

7 files changed

+147
-3
lines changed

semgrep_output_v1.atd

+3
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,7 @@ type sca_error = [
23822382
* Used as the unit of analysis for supply chain.
23832383
*)
23842384
type subproject
2385+
<ocaml attr="deriving show">
23852386
<python decorator="dataclass(frozen=True, order=True)"> =
23862387
{
23872388
root_dir: fpath;
@@ -2554,6 +2555,7 @@ type function_call <python decorator="dataclass(frozen=True)"> = [
25542555
(* for now, the transitive reachability filter takes only a single dependency graph as input.
25552556
* it is up to the caller to call it several times, one for each subproject *)
25562557
| CallTransitiveReachabilityFilter of transitive_reachability_filter_params
2558+
| CallMatchSubprojects of fpath list
25572559
]
25582560

25592561
(* ----------------------------- *)
@@ -2573,6 +2575,7 @@ type function_return <python decorator="dataclass(frozen=True)"> = [
25732575
| RetDumpRulePartitions of bool
25742576
| RetTransitiveReachabilityFilter of transitive_finding list
25752577
| RetGetTargets of target_discovery_result
2578+
| RetMatchSubprojects of subproject list
25762579
]
25772580

25782581
(*****************************************************************************)

semgrep_output_v1.jsonschema

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

semgrep_output_v1.proto

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

semgrep_output_v1.py

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

semgrep_output_v1.ts

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

semgrep_output_v1_j.ml

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

semgrep_output_v1_j.mli

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

0 commit comments

Comments
 (0)