Skip to content

Commit c302316

Browse files
authored
feat: also allow modules for metavariable-name (#295)
Similar to `type` and `types`, extends the existing support for `module` to also allow for `modules`. - [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
1 parent 724cfcc commit c302316

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

rule_schema_v1.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,15 +659,23 @@ $defs:
659659
title: Kind keyword
660660
type: string
661661
module:
662-
title: Kind keyword
662+
title: A module name
663663
type: string
664+
modules:
665+
title: A list of module names
666+
type: array
667+
items:
668+
type: string
664669
required:
665670
- metavariable
666671
anyOf:
667672
- required:
668673
- kind
669-
- required:
670-
- module
674+
- oneOf:
675+
- required:
676+
- module
677+
- required:
678+
- modules
671679
additionalProperties: false
672680
required:
673681
- semgrep-internal-metavariable-name

rule_schema_v2.atd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ type metavariable_cond = {
415415
?kind: string option;
416416
(* for semgrep-internal-metavariable-name; consider renaming? for v2 *)
417417
?module_ <json name="module">: string option;
418+
?modules: string list option;
418419

419420
(* this covers regex:/pattern:, but also all:/any: with optional where:
420421
* CHECK: language is valid only when combined with a formula

0 commit comments

Comments
 (0)