-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,59 @@ | ||
# Cairo hooks for pre-commit | ||
# Pre-commit Hooks for Cairo | ||
|
||
[Cairo](https://www.cairo-lang.org/) tools package for [pre-commit](https://pre-commit.com). | ||
Enhance your [Cairo](https://www.cairo-lang.org/) development workflow with the [pre-commit](https://pre-commit.com) toolset. | ||
|
||
## Using cairo tools with pre-commit | ||
1. Install pre-commit with pip (or check [pre-commit](https://pre-commit.com/#install) docs). | ||
## Integrating Cairo Tools with pre-commit | ||
1. Begin by installing pre-commit using pip (refer to [pre-commit documentation](https://pre-commit.com/#install) if needed). | ||
```sh | ||
pip install pre-commit | ||
``` | ||
|
||
2. Create a `.pre-commit-config.yaml` file in the root of your project. | ||
|
||
2. Create a .pre-commit-config.yaml in your root project | ||
3. Populate your pre-commit configuration with the desired hooks: | ||
```yaml | ||
repos: | ||
- repo: https://github.com/dubzn/pre-commit-cairo.git | ||
rev: v0.1.3 | ||
hooks: | ||
- id: scarb-fmt | ||
args: [--check] | ||
- id: scarb-test | ||
args: [] | ||
# include other hooks | ||
``` | ||
|
||
3. Add the hooks that you want in your pre-commit configuration | ||
*Note: The available hooks for version `v0.1.3` are:* | ||
```yaml | ||
- repo: https://github.com/dubzn/pre-commit-cairo | ||
rev: v0.1.0 | ||
hooks: | ||
- id: scarb-fmt | ||
- id: scarb-build | ||
- id: scarb-clean | ||
- id: scarb-test | ||
|
||
- id: foundry-test | ||
# Scarb | ||
|
||
# Run Scarb tests to ensure the reliability of the Cairo project. | ||
- id: scarb-fmt | ||
|
||
# Run Scarb tests to ensure the reliability of the Cairo project. | ||
- id: scarb-test | ||
|
||
# Use Scarb to execute the build process for the Cairo project. | ||
- id: scarb-build | ||
|
||
# Run the Scarb clean command to remove temporary files in the Cairo project. | ||
- id: scarb-clean | ||
|
||
# Foundry | ||
|
||
# Run Foundry tests to ensure the reliability of the Cairo project. | ||
- id: foundry-test | ||
``` | ||
4. Install pre-commit config. | ||
```sh | ||
pre-commit install | ||
``` | ||
|
||
4. Execute pre-commit install | ||
5. Enjoy the streamlined development process! 🎉 | ||
|
||
5. Enjoy! | ||
--- | ||
|
||
⚠️ This repository uses | ||
### Make sure you have the dependencies installed according to your project: | ||
- [Scarb](https://docs.swmansion.com/scarb/) | ||
- [Foundry](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html) | ||
- [Foundry](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html) |