Skip to content

Commit

Permalink
fix: do not return failure code on warning
Browse files Browse the repository at this point in the history
Fail only if there are errors, let warnings pass.
  • Loading branch information
charislam committed Nov 14, 2024
1 parent d4ca8ca commit 8ccf6d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod rules;
mod utils;

pub use crate::config::Config;
pub use crate::errors::LintLevel;
pub use crate::output::{rdf::RdfFormatter, simple::SimpleFormatter, LintOutput, OutputFormatter};
pub use crate::utils::is_lintable;

Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use glob::glob;
use log::{debug, error};
use simplelog::{ColorChoice, Config as LogConfig, LevelFilter, TermLogger, TerminalMode};
use supa_mdx_lint::{
is_lintable, Config, LintOutput, LintTarget, Linter, LinterBuilder, OutputFormatter,
is_lintable, Config, LintLevel, LintOutput, LintTarget, Linter, LinterBuilder, OutputFormatter,
};

const DEFAULT_CONFIG_FILE: &str = "supa-mdx-lint.config.toml";
Expand Down Expand Up @@ -145,7 +145,10 @@ fn execute() -> Result<Result<()>> {

stdout.flush()?;

if diagnostics.iter().any(|d| !d.errors().is_empty()) {
if diagnostics
.iter()
.any(|d| d.errors().iter().any(|e| e.level == LintLevel::Error))
{
Ok(Err(anyhow::anyhow!("Linting errors found")))
} else {
Ok(Ok(()))
Expand Down

0 comments on commit 8ccf6d7

Please sign in to comment.