Skip to content

Commit

Permalink
Add Dockerfile checks for cargo clippy and cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Feb 15, 2024
1 parent c815d30 commit 5b829ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ WORKDIR /usr/src/myapp
COPY . .

# Compile the application
RUN cargo build --release
RUN rustup component add clippy
RUN cargo clippy -- -D warnings

ENV RUST_TEST_THREADS=1
RUN rustup component add rustfmt
RUN cargo fmt --all -- --check

RUN cargo build --release

# Run tests
CMD ["cargo", "test"]
ENV RUST_TEST_THREADS=1
CMD ["cargo", "test", "--release"]
4 changes: 3 additions & 1 deletion src/operations/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ pub fn set(config_path: &Path, data_path: &Path, full_scheme_name: &str) -> Resu

// Collect config items that match the provided system
let system_items = items.iter().filter(|item| match &item.supported_systems {
Some(supported_systems) => supported_systems.contains(&SupportedSchemeSystems::from_str(scheme_system)),
Some(supported_systems) => {
supported_systems.contains(&SupportedSchemeSystems::from_str(scheme_system))
}
None => false,
});

Expand Down
2 changes: 1 addition & 1 deletion tests/cli_set_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod common;

use crate::common::{cleanup, COMMAND_NAME, REPO_NAME};
use anyhow::{Result, anyhow};
use anyhow::{anyhow, Result};
use std::fs;
use std::path::{Path, PathBuf};

Expand Down

0 comments on commit 5b829ef

Please sign in to comment.