Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cairo-lint ci #238

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ jobs:
mdl -s .github/linter/readme_style.rb README.md
mdl -s .github/linter/base_style.rb .github

cairo-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Install cairo-lint
run: cargo install scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint

- uses: asdf-vm/actions/install@v3
- run: scarb cairo-lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the CI check should fail if there are existing Cairo-lint warnings. What do you think?

Copy link
Contributor Author

@okhaimie-dev okhaimie-dev Oct 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this, there are some linting warning I don't think we might want to follow.

Example:

warning: Plugin diagnostic: Leaving `panic!` in the code is discouraged.
  --> /home/runner/work/shinigami/shinigami/packages/engine/src/cond_stack.cairo:90:18
   |
90 |             _ => panic!("Invalid condition")

I think there are some valid panics, so if this type fails might not be the desired result

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see if there is a way to ignore lints, but I think all the existing lints we want to follow. Even the panic one, we don't want any panic conditions ( and this branch should never be reached anyway ).

- run: scarb cairo-lint --fix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this run needed? The changes wouldn't persist to the branch right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also thinking to remove the run: scarb cairo-lint --fix but wanted to here your feedback on this


test:
runs-on: ubuntu-latest
steps:
Expand Down