-
Notifications
You must be signed in to change notification settings - Fork 49
chore: add pre-commit hooks for code quality checks #3194
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
Changes from all commits
960bd6f
3b3d2fc
2d378cd
43dde2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Pre-commit hooks for platform | ||
| # Install: pip install pre-commit && pre-commit install && pre-commit install --hook-type pre-push | ||
| # See https://pre-commit.com for more information | ||
| repos: | ||
| # ============================================================================ | ||
| # FAST CHECKS - Run on every commit. | ||
| # ============================================================================ | ||
|
|
||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| exclude: | | ||
| (?x)^( | ||
| .*\.md$ | ||
| )$ | ||
| - id: check-yaml | ||
| args: ['--allow-multiple-documents'] | ||
| - id: check-json | ||
| exclude: | | ||
| (?x)^( | ||
| .*tsconfig.*\.json$| | ||
| .*devcontainer.*\.json$| | ||
| .*/AI_QA/.*\.json$| | ||
| .*/tests/fixtures/.*\.json$ | ||
| )$ | ||
| - id: check-toml | ||
| - id: check-merge-conflict | ||
| - id: mixed-line-ending | ||
| args: ['--fix=lf'] | ||
| - id: check-added-large-files | ||
| args: ['--maxkb=1000'] | ||
| - id: check-case-conflict | ||
|
|
||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.22.1 | ||
| hooks: | ||
| - id: gitleaks | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: cargo-fmt | ||
| name: cargo fmt | ||
| description: Format Rust code with rustfmt | ||
| entry: cargo fmt --all | ||
| language: system | ||
| types: [rust] | ||
| pass_filenames: false | ||
|
|
||
| # ============================================================================ | ||
| # SLOW CHECKS - Run on git push only. | ||
| # ============================================================================ | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: clippy | ||
| name: clippy (workspace) | ||
| description: Run clippy on entire workspace | ||
| entry: cargo clippy --workspace --all-features -- -D warnings | ||
| language: system | ||
| types: [rust] | ||
| pass_filenames: false | ||
| stages: [pre-push, manual] | ||
|
Comment on lines
+56
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clippy flags should match CI to prevent surprise failures. The pre-commit clippy hook uses only
🔧 Proposed fix to align with CI - id: clippy
name: clippy (workspace)
description: Run clippy on entire workspace
- entry: cargo clippy --workspace
+ entry: cargo clippy --workspace --all-features -- -D warnings
language: system
types: [rust]
pass_filenames: false
stages: [pre-push, manual]Note: 🤖 Prompt for AI Agents |
||
|
|
||
| exclude: | | ||
| (?x)^( | ||
| target/| | ||
| .*/target/| | ||
| \.cargo/| | ||
| \.git/| | ||
| node_modules/| | ||
| .*/node_modules/| | ||
| .*\.lock$| | ||
| .*\.min\.js$| | ||
| .*\.min\.css$| | ||
| .*\.cjs$| | ||
| \.yarn/.*| | ||
| \.pnp\.*| | ||
| packages/rs-sdk/tests/vectors/.*| | ||
| packages/rs-drive-abci/tests/supporting_files/.*| | ||
| packages/rs-drive/tests/supporting_files/.*| | ||
| packages/wallet-lib/fixtures/.*| | ||
| packages/wasm-drive-verify/tests/fixtures/.*| | ||
| packages/dapi-grpc/clients/.*| | ||
| .*_pb\.js$| | ||
| .*_pb\.d\.ts$| | ||
| .*_pb_service\.js$| | ||
| .*_pb_service\.d\.ts$| | ||
| .*\.pbrpc\.h$| | ||
| \.github/grpc-queries-cache\.json| | ||
| CHANGELOG\.md | ||
| )$ | ||
Uh oh!
There was an error while loading. Please reload this page.