Skip to content

Commit

Permalink
Add GetTargets semgrep-core RPC (#347)
Browse files Browse the repository at this point in the history
- [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]>
  • Loading branch information
nmote and mjambon authored Feb 12, 2025
1 parent 3a9f93e commit 56950a4
Show file tree
Hide file tree
Showing 7 changed files with 4,778 additions and 4,340 deletions.
10 changes: 10 additions & 0 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,14 @@ type skipped_rule = {
position: position;
}

(* Result of get_targets internal RPC, similar to scanned_and_skipped but
more complete *)
type target_discovery_result = {
target_paths: fpath list;
errors: core_error list;
skipped: skipped_target list;
}

(*****************************************************************************)
(* Profiling information *)
(*****************************************************************************)
Expand Down Expand Up @@ -2324,6 +2332,7 @@ type function_call <python decorator="dataclass(frozen=True)"> = [
| CallUploadSymbolAnalysis of ((* token *) string * (* scan_id *) int * symbol_analysis)
| CallDumpRulePartitions of dump_rule_partitions_params
| CallTransitiveReachabilityFilter of transitive_finding list
| CallGetTargets of scanning_roots
]

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

(*****************************************************************************)
Expand Down
36 changes: 36 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.

Loading

0 comments on commit 56950a4

Please sign in to comment.