Skip to content

Commit 56950a4

Browse files
nmotemjambon
andauthored
Add GetTargets semgrep-core RPC (#347)
- [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! Co-authored-by: Martin Jambon <[email protected]>
1 parent 3a9f93e commit 56950a4

7 files changed

+4778
-4340
lines changed

semgrep_output_v1.atd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,14 @@ type skipped_rule = {
903903
position: position;
904904
}
905905

906+
(* Result of get_targets internal RPC, similar to scanned_and_skipped but
907+
more complete *)
908+
type target_discovery_result = {
909+
target_paths: fpath list;
910+
errors: core_error list;
911+
skipped: skipped_target list;
912+
}
913+
906914
(*****************************************************************************)
907915
(* Profiling information *)
908916
(*****************************************************************************)
@@ -2324,6 +2332,7 @@ type function_call <python decorator="dataclass(frozen=True)"> = [
23242332
| CallUploadSymbolAnalysis of ((* token *) string * (* scan_id *) int * symbol_analysis)
23252333
| CallDumpRulePartitions of dump_rule_partitions_params
23262334
| CallTransitiveReachabilityFilter of transitive_finding list
2335+
| CallGetTargets of scanning_roots
23272336
]
23282337

23292338
(* ----------------------------- *)
@@ -2342,6 +2351,7 @@ type function_return <python decorator="dataclass(frozen=True)"> = [
23422351
| RetUploadSymbolAnalysis of (* success msg *) string
23432352
| RetDumpRulePartitions of bool
23442353
| RetTransitiveReachabilityFilter of transitive_finding list
2354+
| RetGetTargets of target_discovery_result
23452355
]
23462356

23472357
(*****************************************************************************)

semgrep_output_v1.jsonschema

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)