Skip to content

build.sh: run cargo fmt --check and cargo clippy after build#299

Merged
MGudgin merged 1 commit into
mainfrom
user/gudge/build-sh-fmt-clippy
May 12, 2026
Merged

build.sh: run cargo fmt --check and cargo clippy after build#299
MGudgin merged 1 commit into
mainfrom
user/gudge/build-sh-fmt-clippy

Conversation

@MGudgin

@MGudgin MGudgin commented May 12, 2026

Copy link
Copy Markdown
Member

📖 Description

Brings build.sh (Linux) to parity with build.bat (Windows), which already runs cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings after the Rust build (build.bat:62-64).

CI runs the same two commands as a gate on every PR. Running them locally before pushing avoids a 3-minute round-trip when something trivial (formatting, an easy lint) trips the gate.

Cost in the developer loop: negligible after the first build. On a typical Windows-on-ARM workstation:

Scenario Time
Cold (after cargo clean) ~38s
Warm (no changes) ~1s
Incremental (1 file touched) ~2s

The cold cost is paid once; subsequent runs share clippy's incremental compilation cache with cargo build.

🔗 References

Motivated by hitting clippy::field_reassign_with_default in CI on #291 after only running cargo build / cargo test locally — build.bat would have caught it before pushing, build.sh would not have.

🔍 Validation

  • Eyeballed: pattern mirrors build.bat lines 62-64.
  • build.sh keeps set -euo pipefail, so non-zero exit from either command halts the script before the SDK build step.
  • No flag changes; existing --debug, --rust-only, --with-hyperlight behavior is preserved (both lint commands always run regardless).
Microsoft Reviewers: Open in CodeFlow

Matches what build.bat already does on Windows (lines 62-64).
CI runs the same two commands as a gate on every PR, so catching
violations locally before pushing keeps the round-trip short. Cost
is negligible after the first build: ~1s warm, ~2s incremental.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MGudgin MGudgin merged commit f57ff04 into main May 12, 2026
8 checks passed
@MGudgin MGudgin deleted the user/gudge/build-sh-fmt-clippy branch May 12, 2026 22:35
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.

2 participants