Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry
common --registry=https://bcr.bazel.build


# Clippy linting (enabled by default)
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build --output_groups=+clippy_checks
build --@rules_rust//rust/settings:clippy.toml=@score_rust_policies//clippy/strict:clippy.toml

# Flags needed by score_baselibs and communication modules.
# Do not add more!
build --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/bazel_clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
name: Bazel Clippy

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
merge_group:
types: [checks_requested]

jobs:
bazel-clippy:
uses: eclipse-score/cicd-workflows/.github/workflows/static-analysis.yml@main
with:
bazel-target: "build //:clippy"
13 changes: 13 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# *******************************************************************************

load("@score_docs_as_code//:docs.bzl", "docs")
load("@rules_rust//rust:defs.bzl", "rust_clippy")

docs(
data = [
Expand All @@ -32,3 +33,15 @@ filegroup(
srcs = ["README.md"],
visibility = ["//visibility:public"],
)

rust_clippy(
name = "clippy",
testonly = True,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
"//feature_integration_tests/rust_test_scenarios:rust_test_scenarios",
# "//feature_showcase/rust:kyron_example",
"//feature_showcase/rust:orch_per_example",
],
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ git_override(

# imports for the feature showcase module
bazel_dep(name = "rules_rust", version = "0.61.0")
bazel_dep(name = "score_rust_policies", version = "0.0.2", dev_dependency = True)
bazel_dep(name = "score_itf", version = "0.1.0")
bazel_dep(name = "score_crates", version = "0.0.4")
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ bazel build --config bl-x86_64-linux \
bazel build --config bl-x86_64-linux @score_orchestrator//src/...
```

## Clippy

- Clippy runs by default via `.bazelrc` on all Rust targets (Rust tests may be tagged `no-clippy`).
- Use `bazel build //:clippy` if you want an explicit lint-only target, or build the Rust targets normally to see Clippy diagnostics.
- The Clippy config comes from `@score_rust_policies//clippy/strict:clippy.toml`.

## Feature showcase examples
The examples that are aiming to showcase features provided by S-CORE are located in `feature_showcase` folder.
You can run them currently for host platform using `--config bl-x86_64-linux`.
Expand Down
7 changes: 5 additions & 2 deletions feature_integration_tests/rust_test_scenarios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ load("@rules_rust//rust:defs.bzl", "rust_binary")
rust_binary(
name = "rust_test_scenarios",
srcs = glob(["src/**/*.rs"]),
visibility = ["//feature_integration_tests/python_test_cases:__pkg__"],
visibility = [
"//feature_integration_tests/python_test_cases:__pkg__",
"//visibility:public",
],
tags = [
"manual",
],
Expand All @@ -31,4 +34,4 @@ rust_binary(
"@score_crates//:serde",
"@score_crates//:serde_json",
],
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async fn kvs_save_cycle_number(path: String) -> Result<(), UserErrValue> {

// Simple set/get.
let key = "run_cycle_number";
let last_cycle_number: u32 = kvs.get_value_as::<u32>(key).unwrap_or_else(|_| 0_u32);
let last_cycle_number: u32 = kvs.get_value_as::<u32>(key).unwrap_or(0_u32);

kvs.set_value(key, last_cycle_number + 1)
.expect("Failed to set value");
Expand Down
Loading