From 1a6e0857cb35cc70f68665df55c59c51a7ea22d3 Mon Sep 17 00:00:00 2001 From: Kai Hudalla Date: Fri, 21 Feb 2025 13:44:06 +0100 Subject: [PATCH 1/2] Exclude irrelevant code from test coverage runs --- Cargo.toml | 5 +++++ src/communication/notification.rs | 1 + src/communication/pubsub.rs | 1 + src/communication/rpc.rs | 2 ++ src/utransport.rs | 2 ++ 5 files changed, 11 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ddbeb5e..900e84c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,3 +95,8 @@ required-features = ["communication", "util"] [[example]] name = "simple_rpc" required-features = ["communication", "util"] + +[lints.rust] +# this prevents cargo from complaining about code blocks +# excluded from tarpaulin coverage checks +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } diff --git a/src/communication/notification.rs b/src/communication/notification.rs index 8617e4f..82f15c8 100644 --- a/src/communication/notification.rs +++ b/src/communication/notification.rs @@ -30,6 +30,7 @@ pub enum NotificationError { NotifyError(UStatus), } +#[cfg(not(tarpaulin_include))] impl Display for NotificationError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/src/communication/pubsub.rs b/src/communication/pubsub.rs index 9be0645..e4d2487 100644 --- a/src/communication/pubsub.rs +++ b/src/communication/pubsub.rs @@ -31,6 +31,7 @@ pub enum PubSubError { PublishError(UStatus), } +#[cfg(not(tarpaulin_include))] impl Display for PubSubError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/src/communication/rpc.rs b/src/communication/rpc.rs index 3be02a8..344174b 100644 --- a/src/communication/rpc.rs +++ b/src/communication/rpc.rs @@ -291,6 +291,7 @@ pub trait RpcServer { ) -> Result<(), RegistrationError>; } +#[cfg(not(tarpaulin_include))] #[cfg(any(test, feature = "test-util"))] mockall::mock! { /// This extra struct is necessary in order to comply with mockall's requirements regarding the parameter lifetimes @@ -301,6 +302,7 @@ mockall::mock! { } } +#[cfg(not(tarpaulin_include))] #[cfg(any(test, feature = "test-util"))] #[async_trait] /// This delegates the invocation of the UTransport functions to the mocked functions of the Transport struct. diff --git a/src/utransport.rs b/src/utransport.rs index 553bb1a..08e1c4a 100644 --- a/src/utransport.rs +++ b/src/utransport.rs @@ -271,6 +271,7 @@ pub trait UTransport: Send + Sync { } } +#[cfg(not(tarpaulin_include))] #[cfg(any(test, feature = "test-util"))] mockall::mock! { /// This extra struct is necessary in order to comply with mockall's requirements regarding the parameter lifetimes @@ -282,6 +283,7 @@ mockall::mock! { } } +#[cfg(not(tarpaulin_include))] #[cfg(any(test, feature = "test-util"))] #[async_trait] /// This delegates the invocation of the UTransport functions to the mocked functions of the Transport struct. From 600623d81c4baba4565b80a0200178e3e7ae2693 Mon Sep 17 00:00:00 2001 From: Kai Hudalla Date: Fri, 21 Feb 2025 15:48:27 +0100 Subject: [PATCH 2/2] Use shared workflow definition for running cargo-deny --- .github/workflows/nightly.yaml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 9ae22b5..d14a13c 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -36,16 +36,7 @@ jobs: uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-latest-deps.yaml@main deny: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - uses: EmbarkStudios/cargo-deny-action@v2 - with: - rust-version: ${{ env.RUST_TOOLCHAIN }} - command: check - arguments: --all-features + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-deny-check.yaml@main # [impl->req~up-language-ci-test~1] test-all-features: