Skip to content

Commit 28a800e

Browse files
authored
Add RPC to show subprojects (#424)
This delegates some text formatting to OCaml so as to avoid maintaining two implementations. - [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! - [x] Any accompanying changes in `semgrep-proprietary` are approved and ready to merge once this PR is merged
1 parent 35d7b72 commit 28a800e

9 files changed

+190
-18
lines changed

semgrep_output_v1.atd

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ type match_intermediate_var
608608

609609
type ecosystem
610610
<python decorator="dataclass(frozen=True)">
611-
<ocaml attr="deriving eq, ord, show">
611+
<ocaml attr="deriving eq, ord, show { with_path = false }">
612612
<doc text="
613613
both ecosystem and transitivity below have frozen=True so the generated
614614
classes can be hashed and put in sets (see calls to reachable_deps.add()
@@ -2896,7 +2896,7 @@ type dump_rule_partitions_params = {
28962896
(* ----------------------------- *)
28972897

28982898
type lockfile_kind
2899-
<ocaml attr="deriving show, eq, yojson">
2899+
<ocaml attr="deriving show { with_path = false }, eq, yojson">
29002900
<python decorator="dataclass(frozen=True)"> =
29012901
[
29022902
| PipRequirementsTxt
@@ -2927,7 +2927,7 @@ type lockfile_kind
29272927
] <ocaml repr="classic">
29282928

29292929
type manifest_kind
2930-
<ocaml attr="deriving show, eq">
2930+
<ocaml attr="deriving show { with_path = false }, eq">
29312931
<python decorator="dataclass(frozen=True)"> =
29322932
[
29332933
| RequirementsIn
@@ -3398,6 +3398,15 @@ type function_call <python decorator="dataclass(frozen=True)"> = [
33983398
| CallMatchSubprojects of fpath list
33993399
(* run symbol analysis for the project rooted in the given directory *)
34003400
| CallRunSymbolAnalysis of symbol_analysis_params
3401+
(*************************************************************************)
3402+
(* Text output formatting *)
3403+
(*************************************************************************)
3404+
| CallShowSubprojects
3405+
<doc text="
3406+
Format human-readable text summarizing the subprojects that were
3407+
discovered in a project. This is meant to be printed in --verbose mode.
3408+
">
3409+
of subproject list
34013410
]
34023411

34033412
(* ----------------------------- *)
@@ -3423,6 +3432,16 @@ type function_return <python decorator="dataclass(frozen=True)"> = [
34233432
| RetGetTargets of target_discovery_result
34243433
| RetMatchSubprojects of subproject list
34253434
| RetRunSymbolAnalysis of symbol_analysis
3435+
(*************************************************************************)
3436+
(* Text output formatting *)
3437+
(*************************************************************************)
3438+
| RetShowSubprojects
3439+
<doc text="
3440+
The text return here typically contains newlines but is not
3441+
newline-terminated i.e. it is suitable to pass as an argument to
3442+
a logger.
3443+
">
3444+
of string
34263445
]
34273446

34283447
type function_result = {

semgrep_output_v1.jsonschema

Lines changed: 27 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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

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

semgrep_output_v1.ts

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

semgrep_output_v1_j.ml

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

semgrep_output_v1_j.mli

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

0 commit comments

Comments
 (0)