Minimal git hook to run ast-grep based on the pre-commit framework.
Add this to your .pre-commit-config.yaml
:
- repo: https://github.com/boidolr/ast-grep-pre-commit
rev: 0.32.2 # Use the ref you want to point at
hooks:
- id: ast-grep
Note that only rules with a severity of "error" will lead to the commit hook failing.
- repo: https://github.com/boidolr/ast-grep-pre-commit
rev: 0.32.2
hooks:
- id: ast-grep
args: ["--update-all"]
- repo: https://github.com/boidolr/ast-grep-pre-commit
rev: 0.32.2
hooks:
- id: ast-grep
args: ["--config", "/some/path/sgconfig.yaml"]
See https://ast-grep.github.io/ for details on ast-grep
and how to write linters and rewriters.