- Install the latest Rust via rustup.
- Install the latest Scarb via ASDF.
- Before you open a pull request, it is always a good idea to search the issues and verify if the feature you would like to add hasn't been already discussed.
- We also appreciate creating a feature request before making a contribution, so it can be discussed before you get to work.
- If the change you are introducing is changing or breaking the behavior of any already existing features, make sure to include that information in the pull request description.
In order to add a new rule, you must extend a context with a new lint or whole lint group.
To run the tests you'll need to provide the path to the cairo corelib (at some point this should be automated but we're not there yet).
CORELIB_PATH="/path/to/corelib/src" cargo test
cargo insta review
To add a new test you can use the dev cli with:
cargo xtask create-test --name "Your lint name" --group "Your lint group name"
Each lint should have its own tests and should be extensive. To create a new test for a lint you need to create a new file/module in the test_files folder and should be named as your lint. The file should
As for tests, we are using insta snapshot library. There are 2 testing macros:
Tests should use only the inline snapshots.
When creating a new test, you can run CORELIB_PATH={path} cargo test
, and see if your snapshots match. It's recommended to use the the cargo-insta tool to review the snapshots. Just remember to first run the tests with cargo test
, and after that run cargo insta review
to review any snapshot differences.