Skip to content

Commit

Permalink
update pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzn committed Jan 7, 2024
1 parent 204b204 commit 45a1986
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
33 changes: 27 additions & 6 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
- id: fmt
name: fmt
description: Format files with Scarb fmt
# SCARB HOOKS
- id: scarb-fmt
name: cairo fmt (Scarb)
description: Format files with Scarb
entry: scarb fmt
language: system
args: []
- id: test
name: cairo test
description: Run tests with Scarb test
- id: scarb-test
name: cairo test (Scarb)
description: Run tests with Scarb
entry: scarb test
language: system
args: []
- id: scarb-build
name: cairo build (Scarb)
description: Run build with Scarb
entry: scarb build
language: system
args: []
- id: scarb-clean
name: cairo clean (Scarb)
description: Run clean with Scarb
entry: scarb clean
language: system
args: []

# FOUNDRY HOOKS
- id: foundry-test
name: cairo test (Foundry)
description: Run tests with Foundry
entry: snforge test
language: system
args: []
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
[Cairo](https://www.cairo-lang.org/) tools package for [pre-commit](https://pre-commit.com).

## Using cairo tools with pre-commit
1. Install pre-commit with pip (or check [pre-commit](https://pre-commit.com/#install) docs).

2. Create a .pre-commit-config.yaml in your root project

3. Add the hooks that you want in your pre-commit configuration
```yaml
- repo: https://github.com/dubzn/pre-commit-cairo
rev: master
rev: v0.1.0
hooks:
- id: fmt
- id: test
- id: scarb-fmt
- id: scarb-build
- id: scarb-clean
- id: scarb-test

- id: foundry-test
```
⚠️ This repository uses [Scarb](https://docs.swmansion.com/scarb/) commands, so it is a necessary dependency.
4. Execute pre-commit install
5. Enjoy!
⚠️ This repository uses
- [Scarb](https://docs.swmansion.com/scarb/)
- [Foundry](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html)

0 comments on commit 45a1986

Please sign in to comment.