Skip to content

Commit

Permalink
feat: implement sarif format reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Jun 29, 2024
1 parent c16dc8f commit 50550f1
Show file tree
Hide file tree
Showing 7 changed files with 350 additions and 11 deletions.
191 changes: 186 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/typos-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ colorchoice-clap = "1.0.3"
serde_regex = "1.1.0"
regex = "1.10.4"
encoding_rs = "0.8.34"
serde-sarif = "0.4.2"

[dev-dependencies]
assert_fs = "1.1"
Expand Down
2 changes: 2 additions & 0 deletions crates/typos-cli/src/bin/typos-cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) enum Format {
#[default]
Long,
Json,
Sarif,
}

impl Format {
Expand All @@ -19,6 +20,7 @@ impl Format {
Format::Brief => Box::new(crate::report::PrintBrief),
Format::Long => Box::new(crate::report::PrintLong),
Format::Json => Box::new(crate::report::PrintJson),
Format::Sarif => Box::new(crate::report::PrintSarif::default()),
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions crates/typos-cli/src/bin/typos-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use std::io::{BufRead as _, BufReader, Write as _};
use std::path::PathBuf;

use clap::Parser;
use proc_exit::prelude::*;

use typos_cli::report::Report;

mod args;
mod report;

use proc_exit::prelude::*;

fn main() {
human_panic::setup_panic!();
let result = run();
Expand Down Expand Up @@ -316,6 +317,8 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
if status_reporter.errors_found() {
errors_found = true;
}

status_reporter.finalize().unwrap();
}

if errors_found {
Expand Down
Loading

0 comments on commit 50550f1

Please sign in to comment.