Skip to content

chore(ci): add cargo fmt and clippy pre-commit hooks for backend/#186

Merged
ayomideadeniran merged 1 commit intoSoroLabs:mainfrom
AnnabelJoe:feat/rust-precommit-hooks
Mar 30, 2026
Merged

chore(ci): add cargo fmt and clippy pre-commit hooks for backend/#186
ayomideadeniran merged 1 commit intoSoroLabs:mainfrom
AnnabelJoe:feat/rust-precommit-hooks

Conversation

@AnnabelJoe
Copy link
Copy Markdown
Contributor

Summary

Closes #156

Adds explicit cargo fmt and cargo clippy pre-commit hooks via doublify/pre-commit-rust for both Rust crates under backend/.

Changes to .pre-commit-config.yaml

New repo block added using https://github.com/doublify/pre-commit-rust (v1.0):

Hook Target Behaviour
fmt backend/indexer Fails if code is not formatted (--check)
fmt backend/oracle Fails if code is not formatted (--check)
clippy backend/indexer Fails on any warning (-D warnings)
clippy backend/oracle Fails on any warning (-D warnings)

All four hooks run on commit and manual stages.

The existing local quality-gate script (scripts/pre-commit-hook.sh) is retained — it additionally runs cargo test --lib which the new hooks do not cover.

Install / Update Hooks Locally

After pulling this branch, run:

bash

Install pre-commit if not already present

pip install pre-commit

Install/update the hook environments (downloads doublify/pre-commit-rust)

pre-commit install
pre-commit install --hook-type pre-commit

Run all hooks manually against the full repo to verify

pre-commit run --all-files

To run only the Rust hooks manually:
bash
pre-commit run fmt --all-files
pre-commit run clippy --all-files

- Add doublify/pre-commit-rust hooks for cargo fmt (--check) and clippy
  (-D warnings) targeting backend/indexer and backend/oracle separately
- Hooks run on commit and manual stages
- Existing local quality-gate script retained for test coverage
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@AnnabelJoe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ayomideadeniran
Copy link
Copy Markdown
Contributor

Thanks for the PR! This is currently under review and I will get back to you shortly.

@ayomideadeniran ayomideadeniran merged commit 17cd19f into SoroLabs:main Mar 30, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEVOPS] Add Pre-commit Hook for Rust Linting

2 participants