Centralized Rust linting and formatting policies for the Eclipse Safe Open Vehicle Core (S-CORE). This repository packages shared Rust lint/format defaults so every S-CORE crate can use the same safety-focused rules.
- Provide one set of vetted Rust linting and formatting defaults for S-CORE projects.
- Distribute those policies as a Bazel module (
score_rust_policies) so bzlmod users can depend on them directly. - Keep tooling configurations (e.g., Clippy, rustfmt) versioned and auditable in one place.
clippy/strict/clippy.toml: ASIL-B–oriented settings for safety-critical code (enablespedantic/nursery, disallowspanic/unwrap/expect, forbids debug/print macros, and enforces size/complexity thresholds).clippy/relaxed/clippy.toml: For tooling, generators, and tests where controlled panics/unwraps and debug printing are acceptable. Still forbidstodoandunimplemented.
- Wire configs in your repo’s
.bazelrc(mirrorstests/.bazelrc):build:clippy-strict --@rules_rust//rust/settings:clippy.toml=@score_rust_policies//clippy/strict:clippy.toml build:clippy-relaxed --@rules_rust//rust/settings:clippy.toml=@score_rust_policies//clippy/relaxed:clippy.toml - Exclude targets that shouldn’t be linted (e.g., generated code, some tests) by tagging them
no-clippy:rust_test( name = "my_test", srcs = [...], tags = ["no-clippy"], ) - Add a dedicated lint target (pattern from
rules_rust):Then runload("@rules_rust//rust:defs.bzl", "rust_clippy") rust_clippy( name = "clippy", deps = ["//src/rust/..."], tags = ["manual"], testonly = True, visibility = ["//visibility:public"], )bazel build --config=clippy-strict //:clippy(or--config=clippy-relaxed).
- From
tests/(consumer workspace with a local_path_override) run:bazel build --config=strict //:sample_clippybazel build --config=relaxed //:sample_clippy
- The
tests/.bazelrcsets the strict/relaxed Clippy configs to@score_rust_policies//clippy/{strict,relaxed}:clippy.tomlvia@rules_rust//rust/settings:clippy.toml.
- Add to your
MODULE.bazel:bazel_dep(name = "score_rust_policies", version = "0.0.4") - During local development you can pin a checkout with:
local_path_override( module_name = "score_rust_policies", path = "<path-to-this-repo>", ) - Reference policy files in Bazel targets with:
@score_rust_policies//clippy:clippy.tomlfor safety components.@score_rust_policies//clippy:clippy_relaxed.tomlfor tooling/tests.
- When running Clippy directly, pass the config you need:
cargo clippy --config-path path/to/clippy/clippy.toml.
MODULE.bazel: Bazel module metadata forscore_rust_policies.BUILD.bazel: repo root package (tooling configs live in subpackages).LICENSE.md: Apache License 2.0.CONTRIBUTION.md: contribution process and links to S-CORE guidelines..gitignore: common ignores for Bazel and development tooling.clippy/: Clippy configs exported as@score_rust_policies//clippy/{strict,relaxed}:clippy.toml.tests/: consumer workspace that depends on this module vialocal_path_overrideand runs Clippy with strict/relaxed configs.- (planned)
rustfmt/: rustfmt defaults when added.
See CONTRIBUTION.md for how to propose and review policy changes. All contributions require ECA/DCO sign-off and follow the Eclipse Foundation project handbook.
Apache License 2.0. See LICENSE.md.