bazel: Enable rustfmt and clippy in CI#44830
Conversation
In CI, enable rustfmt and clippy checks for Rust targets during the build phase.
| build:ci --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect | ||
| build:ci --output_groups=+clippy_checks | ||
| build:ci --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect | ||
| build:ci --output_groups=+rustfmt_checks |
There was a problem hiding this comment.
This introduces a dev/prod parity issue: code may build locally but fail in CI due to formatting or lint violations, with no local feedback until after push (and CI latency...)
That said, this follows upstream guidance from https://bazelbuild.github.io/rules_rust/rust_fmt.html:
It's recommended to only enable this aspect in your CI environment so formatting issues do not impact users' ability to rapidly iterate on changes.
There is also an efficiency win: Bazel aspects leverage the cache and dependency graph, making them far more efficient than standalone linters that rescan everything. This is a good precedent for adding similar checks in other languages (in lieu of existing ones).
Approving (despite the dev/prod parity caveat).
Let’s iterate based on developer feedback. If "builds locally, fails in CI" becomes painful, we can generalize later. The efficiency gains and alignment with upstream best practices justify starting here.
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
|
In CI, enable rustfmt and clippy checks for Rust targets during the
build phase.
This ensures that the rules are enforced by CI while still allowing developers
to temporarily ignore them locally during development.