Skip to content

chore(contracts): enforce fmt + clippy CI gate and clear all lint/for… - #115

Merged
EmeditWeb merged 1 commit into
mainfrom
chore/contracts-lint-fmt-ci-gate
Sep 24, 2026
Merged

EmeditWeb merged 1 commit into
mainfrom
chore/contracts-lint-fmt-ci-gate

Conversation

@EmeditWeb

Copy link
Copy Markdown
Member

No description provided.

…mat lapses

Contracts CI previously ran only build + test — nothing guarded formatting or
lints, so 91 rustfmt hunks and 27 clippy warnings had accumulated across all
six contracts. This adds the missing gates and brings the tree clean so every
future PR is held to the same bar.

CI (.github/workflows/contracts-ci.yml):
- Add `cargo fmt --all --check` (fast fail, before any compile).
- Add `cargo clippy --workspace --all-targets -- -D warnings`, placed after the
  dependency-WASM build so creditline's contractimport! clients resolve during
  the native clippy compile (otherwise E0599 on receive_guarantee).
- Install rustfmt + clippy toolchain components.

Formatting:
- Apply rustfmt across all six contracts.

Lint fixes (clippy -D warnings now clean):
- Replace `assert_eq!(x, <bool>)` with `assert!` in liquidity-pool and
  creditline tests (10).
- Use `saturating_add` in place of `checked_add(..).unwrap_or(u64::MAX)` in
  vouching TTL math — behaviour-identical (2).
- Use `matches!` in place of match-to-bool in creditline reputation-call
  handling (2).
- Remove unused `Val`/`Vec` imports, an unused `mut`, an unused `registry`
  binding; add an elided lifetime; fix a rustdoc list-item indentation.
- Remove the dead `safe_math` modules from parameters and vendor-registry: both
  already perform overflow-checked arithmetic inline, so no safety is lost.
  creditline, liquidity-pool and reputation keep their used copies.
- Remove an unused `assert_event` test helper.

Test quality:
- Add the missing `share_price_before == 10_000` baseline assertion in the
  creditline default-loss test (the value was captured but never checked).

Verified: fmt clean, clippy -D warnings clean, all contracts build for
wasm32-unknown-unknown (release), 420 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@EmeditWeb
EmeditWeb merged commit b5bd882 into main Sep 24, 2026
4 checks passed
@EmeditWeb
EmeditWeb deleted the chore/contracts-lint-fmt-ci-gate branch September 29, 2026 10:49
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.

1 participant