{
  "slug": "semgrep-dart-patterns-add-typed-metavariables-and-function-definition-matching-4b4b32adf797",
  "title": "Semgrep Dart patterns add typed metavariables and function-definition matching",
  "tools": [
    "semgrep"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-05-27T14:35:42.000Z",
  "announced_at": "2026-05-27T14:35:42.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When writing Dart rules in Semgrep 1.164.0, use the release’s new typed metavariable, `metavariable-type`, interpolation binding, and function-definition matching support. Scan the target with your rule file using `semgrep scan --config <rule.yaml> <target>`.",
    "examples": [
      "semgrep scan --config <rule.yaml> <target>"
    ],
    "gotchas": [
      "Version: 1.164.0",
      "`metavariable-type.metavariable` (required): Metavariable to match.",
      "`metavariable-type.type`: Type expression. Use either `type` or `types`; the schema requires one of them.",
      "`metavariable-type.types`: Array of type expressions. Use either `types` or `type`; the schema requires one of them.",
      "`metavariable-type.language`: Language field in the `metavariable-type` object; its purpose is not described in the schema.",
      "`$X as T`: Dart typed metavariable syntax; the release note names it but the documentation found does not define its matching behavior."
    ]
  },
  "why_it_matters": "Write or update Semgrep rules that match Dart code using typed metavariables, string interpolations, or function definitions.",
  "sources": [
    "https://github.com/semgrep/semgrep/releases/tag/v1.164.0",
    "https://semgrep.dev/docs/semgrep-ci/sample-ci-configs",
    "https://github.com/semgrep/semgrep-interfaces/blob/main/rule_schema_v1.yaml"
  ],
  "rank": 0.97021,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2b-20261017",
    "verdict_id": "wave2b-20261017:wave2b-20261017-38ab6213e790c614-0:gate",
    "evidence_hash": "fafbad268adf357af4d58d54979b17ca364b4e2cb2c4d0c735fd90d566a9a8d4"
  },
  "review": {
    "draft_hash": "28528b9fa07d8d27a35f858b96db159e0583f6ebfa276a7f9bf95d8998e155a8",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2b-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.64 (>= 0.6 needed)."
  }
}
