https://github.com/franalgaba/pre-commit-cairo
Cairo hooks for pre-commit
https://github.com/franalgaba/pre-commit-cairo
Last synced: 9 months ago
JSON representation
Cairo hooks for pre-commit
- Host: GitHub
- URL: https://github.com/franalgaba/pre-commit-cairo
- Owner: franalgaba
- License: mit
- Created: 2022-04-22T14:35:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-21T18:35:50.000Z (about 4 years ago)
- Last Synced: 2025-04-08T04:54:42.832Z (about 1 year ago)
- Language: Python
- Size: 176 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit-cairo
[](https://github.com/franalgaba/pre-commit-cairo/actions/workflows/release.yml)
Cairo hooks for pre-commit. See [pre-commit](https://github.com/pre-commit/pre-commit) for more details
## Using pre-commit-cairo with pre-commit
Add this to your `.pre-commit-config.yaml`
```yaml
- repo: https://github.com/franalgaba/pre-commit-cairo
rev: main # Use the ref you want to point at
hooks:
- id: cairo-lint
- id: cairo-format
```
## Hooks available
### `cairo-lint`
Checks lint of Cairo contracts using [Amarna](https://github.com/crytic/amarna). If it fails a summary table with results is shown as shown below:

Amarna does not have a public release yet. So, to use this hook first you need to install Amarna in your project manually:
`pip install git+https://github.com/crytic/amarna.git@main`
or
`poetry add git+https://github.com/crytic/amarna.git@main`
After a public release for Amarna is made, the hook will install it automatically.
### `cairo-format`
Checks format of Cairo contracts using cairo-lang built in tool `cairo-format`. Command will be run with the `-i` flag.