Skip to content

Commit

Permalink
feat: Warning messages on wrong practices (#314)
Browse files Browse the repository at this point in the history
* feat: Warning messages on wrong practices

* test: Group

* feat: Add warnings
  • Loading branch information
taorepoara committed Nov 22, 2024
1 parent 624148d commit 5ccfe8b
Show file tree
Hide file tree
Showing 9 changed files with 1,333 additions and 766 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,23 @@ Don't forget to give the project a star! Thanks again!
To run the tests, use the following command:

```bash
cargo test --all-features
cargo test
```

#### Test coverage

To generate the test coverage, use the following commands:

```bash
# Generate the coverage report
RUSTFLAGS="-C instrument-coverage" \
RUSTDOCFLAGS="-C instrument-coverage" \
LLVM_PROFILE_FILE="target/coverage/profiles/cargo-test-%p-%m.profraw" \
cargo test
# Convert to lcov format
grcov target/coverage/profiles/ --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore ../* --ignore /* -o target/coverage/lcov.info
# Generate the HTML report
grcov target/coverage/profiles/ --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore ../* --ignore /* -o target/coverage/html
```

### Generate the JSON Schema
Expand Down
7 changes: 3 additions & 4 deletions src/bin/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{CliCommand, GlobalOptions};
use clap::Args;
use colored::{Color, Colorize};
use dofigen_lib::{
generate_dockerignore,
lock::{Lock, LockFile},
DofigenContext, Error, GenerationContext, MessageLevel, Result,
};
Expand Down Expand Up @@ -89,9 +88,9 @@ impl CliCommand for Generate {
locked_image
};

let mut generation_context = GenerationContext::from(&dofigen);
let mut generation_context = GenerationContext::from(dofigen);

let dockerfile_content = generation_context.generate_dockerfile(&dofigen)?;
let dockerfile_content = generation_context.generate_dockerfile()?;

let messages = generation_context.get_lint_messages().clone();

Expand Down Expand Up @@ -125,7 +124,7 @@ impl CliCommand for Generate {
} else {
self.write_dockerfile(
dockerfile_content.as_str(),
generate_dockerignore(&dofigen).as_str(),
generation_context.generate_dockerignore()?.as_str(),
)?;
};
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/dofigen_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub struct Cache {
#[serde(skip_serializing_if = "Option::is_none")]
pub sharing: Option<CacheSharing>,

/// The base of the cache mount
/// Build stage, context, or image name to use as a base of the cache mount. Defaults to empty directory.
#[serde(flatten, skip_serializing_if = "FromContext::is_empty")]
#[patch(name = "FromContextPatch", attribute(serde(flatten)))]
pub from: FromContext,
Expand Down
Loading

0 comments on commit 5ccfe8b

Please sign in to comment.