rule-template.yaml 736 B

123456789101112131415161718192021222324252627282930313233343536
  1. # ast-grep Rule Template
  2. # Place in project root or rules/ directory
  3. # Run with: sg scan
  4. id: rule-id-here
  5. language: typescript # js, python, go, rust, etc.
  6. rule:
  7. # Basic pattern match
  8. pattern: console.log($$$)
  9. # Or use conditions:
  10. # any:
  11. # - pattern: console.log($$$)
  12. # - pattern: console.warn($$$)
  13. #
  14. # not:
  15. # pattern: console.error($$$)
  16. #
  17. # inside:
  18. # pattern: function $_ { $$$ }
  19. message: "Description of the issue"
  20. severity: warning # error | warning | info | hint
  21. # Optional auto-fix
  22. # fix: "replacement using $METAVARS"
  23. # Optional additional context
  24. # note: "Explanation for developers"
  25. # Optional metadata
  26. # metadata:
  27. # category: security
  28. # references:
  29. # - https://example.com/docs