From fb9c71a6ee2e78cfd56651ded84f9fc2b0db9e3d Mon Sep 17 00:00:00 2001 From: Romuald Lemesle Date: Fri, 6 Mar 2026 17:02:24 +0100 Subject: [PATCH 1/3] [agent] chore(clippy): add clippy on CI --- .circleci/config.yml | 8 ++++++++ src/api/manage_jobs.rs | 4 ++-- src/api/register_agent.rs | 2 +- src/process/agent_job.rs | 9 +++++---- src/process/keep_alive.rs | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 389ce63a..7f7308fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,6 +22,7 @@ jobs: # Run checks - run: cargo check - run: cargo fmt -- --check + - run: cargo clippy -- -D warnings - run: name: Lint PowerShell installer scripts (PSScriptAnalyzer) shell: powershell.exe @@ -112,6 +113,7 @@ jobs: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; # Run checks - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" check' + - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" clippy -- -D warnings' - run: name: Lint PowerShell installer scripts (PSScriptAnalyzer) shell: powershell.exe @@ -201,6 +203,7 @@ jobs: - run: . "$HOME/.cargo/env"; rustup target add x86_64-unknown-linux-musl # Run checks - run: cargo check + - run: cargo clippy -- -D warnings - run: . "$HOME/.cargo/env"; cargo build --target=x86_64-unknown-linux-musl --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/x86_64-unknown-linux-musl/release/openaev-agent @@ -261,6 +264,7 @@ jobs: - run: . "$HOME/.cargo/env"; rustup target add aarch64-unknown-linux-musl # Run checks - run: cargo check + - run: cargo clippy -- -D warnings - run: . "$HOME/.cargo/env"; cargo build --target=aarch64-unknown-linux-musl --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/aarch64-unknown-linux-musl/release/openaev-agent @@ -319,6 +323,7 @@ jobs: - run: curl https://sh.rustup.rs -sSf | sh -s -- -y # Run checks - run: cargo check + - run: cargo clippy -- -D warnings - run: . "$HOME/.cargo/env"; cargo build --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/release/openaev-agent @@ -380,6 +385,9 @@ jobs: cargo install cargo-audit # Run checks - run: cargo check + - run: cargo fmt -- --check + - run: cargo clippy -- -D warnings + - run: cargo audit - run: . "$HOME/.cargo/env"; cargo build --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/release/openaev-agent diff --git a/src/api/manage_jobs.rs b/src/api/manage_jobs.rs index 53a4094c..50e98419 100644 --- a/src/api/manage_jobs.rs +++ b/src/api/manage_jobs.rs @@ -42,7 +42,7 @@ impl Client { } } Err(err) => { - error!("Error API list_jobs {}", err.to_string()); + error!("Error API list_jobs {}", err); Err(Error::Internal(err.to_string())) } } @@ -62,7 +62,7 @@ impl Client { } } Err(err) => { - error!("Error API clean_job {}", err.to_string()); + error!("Error API clean_job {}", err); Err(Error::Internal(err.to_string())) } } diff --git a/src/api/register_agent.rs b/src/api/register_agent.rs index 5dca39ff..ce0bf73b 100644 --- a/src/api/register_agent.rs +++ b/src/api/register_agent.rs @@ -114,7 +114,7 @@ impl Client { } } Err(err) => { - error!("Error API register_agent {}", err.to_string()); + error!("Error API register_agent {}", err); Err(Error::Internal(err.to_string())) } } diff --git a/src/process/agent_job.rs b/src/process/agent_job.rs index 6044c839..94ae1627 100644 --- a/src/process/agent_job.rs +++ b/src/process/agent_job.rs @@ -26,8 +26,8 @@ pub fn listen( execution_details.is_elevated, execution_details.executed_by_user.clone(), ); - if jobs.is_ok() { - if let Ok(jobs) = jobs { + match jobs { + Ok(jobs) => { jobs.iter().for_each(|j| { info!("Start handling inject: {:?}", j.asset_agent_inject); // 01. Remove the execution job @@ -43,8 +43,9 @@ pub fn listen( info!("Done handling inject: {:?}", j.asset_agent_inject); }); } - } else { - error!("Fail getting jobs {}", jobs.unwrap_err()) + Err(err) => { + error!("Fail getting jobs {}", err) + } } // Wait for the next ping (30 secs) sleep(Duration::from_secs(30)); diff --git a/src/process/keep_alive.rs b/src/process/keep_alive.rs index f39996af..6df68a2e 100644 --- a/src/process/keep_alive.rs +++ b/src/process/keep_alive.rs @@ -30,8 +30,8 @@ pub fn ping( installation_mode.clone(), service_name.clone(), ); - if register.is_err() { - error!("Fail registering the agent {}", register.unwrap_err()) + if let Err(err) = register { + error!("Fail registering the agent {}", err) } // Wait for the next ping (2 minutes) sleep(Duration::from_secs(120)); From b0a3237164bfc86fddd9ff4b02d3f2a00951ae1b Mon Sep 17 00:00:00 2001 From: Romuald Lemesle Date: Fri, 20 Mar 2026 16:39:23 +0100 Subject: [PATCH 2/3] [agent] chore(clippy): add clippy on CI --- .circleci/config.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f7308fc..fbfb6dd7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,10 +19,13 @@ jobs: - run: rustup default stable-x86_64-pc-windows-msvc - run: choco install -y mingw --version=13.2.0 - run: choco install -y nsis + # Install quality tools + - run: cargo install cargo-audit # Run checks - run: cargo check - run: cargo fmt -- --check - run: cargo clippy -- -D warnings + - run: cargo audit - run: name: Lint PowerShell installer scripts (PSScriptAnalyzer) shell: powershell.exe @@ -111,9 +114,12 @@ jobs: # Install quality tools - run: | $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; + Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" install cargo-audit' # Run checks - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" check' + - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" fmt -- --check' - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" clippy -- -D warnings' + - run: $env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\ARM64\bin;" + $env:PATH; Invoke-Expression '& "$env:USERPROFILE\.cargo\bin\cargo" audit' - run: name: Lint PowerShell installer scripts (PSScriptAnalyzer) shell: powershell.exe @@ -201,9 +207,13 @@ jobs: - run: sudo apt-get -y install curl musl-tools - run: curl https://sh.rustup.rs -sSf | sh -s -- -y - run: . "$HOME/.cargo/env"; rustup target add x86_64-unknown-linux-musl + # Install quality tools + - run: cargo install cargo-audit # Run checks - run: cargo check + - run: cargo fmt -- --check - run: cargo clippy -- -D warnings + - run: cargo audit - run: . "$HOME/.cargo/env"; cargo build --target=x86_64-unknown-linux-musl --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/x86_64-unknown-linux-musl/release/openaev-agent @@ -262,9 +272,13 @@ jobs: - run: sudo apt-get -y install curl musl-tools - run: curl https://sh.rustup.rs -sSf | sh -s -- -y - run: . "$HOME/.cargo/env"; rustup target add aarch64-unknown-linux-musl + # Install quality tools + - run: cargo install cargo-audit # Run checks - run: cargo check + - run: cargo fmt -- --check - run: cargo clippy -- -D warnings + - run: cargo audit - run: . "$HOME/.cargo/env"; cargo build --target=aarch64-unknown-linux-musl --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/aarch64-unknown-linux-musl/release/openaev-agent @@ -321,9 +335,13 @@ jobs: - cargo-{{ arch }}-{{ checksum "Cargo.toml" }} - cargo-{{ arch }} - run: curl https://sh.rustup.rs -sSf | sh -s -- -y + # Install quality tools + - run: cargo install cargo-audit # Run checks - run: cargo check + - run: cargo fmt -- --check - run: cargo clippy -- -D warnings + - run: cargo audit - run: . "$HOME/.cargo/env"; cargo build --release - run: . "$HOME/.cargo/env"; cargo test --release - run: strip ./target/release/openaev-agent @@ -379,10 +397,7 @@ jobs: - run: rustup toolchain install stable-x86_64-apple-darwin - run: rustup default stable-x86_64-apple-darwin # Install quality tools - - run: | - rustup component add clippy - rustup component add rustfmt - cargo install cargo-audit + - run: cargo install cargo-audit # Run checks - run: cargo check - run: cargo fmt -- --check From abd5aedbfd827f159b355447bd6b2668923a0f35 Mon Sep 17 00:00:00 2001 From: Antoine MAZEAS Date: Thu, 7 May 2026 10:21:57 +0200 Subject: [PATCH 3/3] override clippy violation Signed-off-by: Antoine MAZEAS --- src/process/keep_alive.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/process/keep_alive.rs b/src/process/keep_alive.rs index f92c07d1..74d7e105 100644 --- a/src/process/keep_alive.rs +++ b/src/process/keep_alive.rs @@ -8,6 +8,7 @@ use std::thread; use std::thread::{sleep, JoinHandle}; use std::time::Duration; +#[allow(clippy::too_many_arguments)] pub fn ping( uri: String, token: String,