diff --git a/apps/oxlint/src/lib.rs b/apps/oxlint/src/lib.rs index 91d18c97a190b..26dbbe909445f 100644 --- a/apps/oxlint/src/lib.rs +++ b/apps/oxlint/src/lib.rs @@ -8,10 +8,5 @@ mod walk; pub mod cli { - pub use crate::{ - command::*, - lint::LintRunner, - result::{CliRunResult, LintResult}, - runner::Runner, - }; + pub use crate::{command::*, lint::LintRunner, result::CliRunResult, runner::Runner}; } diff --git a/apps/oxlint/src/lint.rs b/apps/oxlint/src/lint.rs index 6c740a90990ce..49db106490314 100644 --- a/apps/oxlint/src/lint.rs +++ b/apps/oxlint/src/lint.rs @@ -16,7 +16,7 @@ use oxc_span::VALID_EXTENSIONS; use serde_json::Value; use crate::{ - cli::{CliRunResult, LintCommand, LintResult, MiscOptions, Runner, WarningOptions}, + cli::{CliRunResult, LintCommand, MiscOptions, Runner, WarningOptions}, output_formatter::{LintCommandInfo, OutputFormatter}, walk::{Extensions, Walk}, }; @@ -80,7 +80,7 @@ impl Runner for LintRunner { // filtered, return early. if provided_path_count > 0 { // ToDo: when oxc_linter (config) validates the configuration, we can use exit_code = 1 to fail - return CliRunResult::LintResult(LintResult::default()); + return CliRunResult::LintResult(ExitCode::SUCCESS); } paths.push(self.cwd.clone()); @@ -226,12 +226,7 @@ impl Runner for LintRunner { stdout.write_all(end.as_bytes()).or_else(Self::check_for_writer_error).unwrap(); }; - CliRunResult::LintResult(LintResult { - number_of_files, - number_of_warnings: diagnostic_result.warnings_count(), - number_of_errors: diagnostic_result.errors_count(), - exit_code: ExitCode::from(u8::from(diagnostic_failed)), - }) + CliRunResult::LintResult(ExitCode::from(u8::from(diagnostic_failed))) } } diff --git a/apps/oxlint/src/result.rs b/apps/oxlint/src/result.rs index 2854bdef1f83f..c880613797d70 100644 --- a/apps/oxlint/src/result.rs +++ b/apps/oxlint/src/result.rs @@ -6,24 +6,18 @@ use std::{ #[derive(Debug)] pub enum CliRunResult { None, - InvalidOptions { message: String }, - PathNotFound { paths: Vec }, - LintResult(LintResult), - PrintConfigResult, - ConfigFileInitResult { message: String }, -} - -/// A summary of a complete linter run. -#[derive(Debug, Default)] -pub struct LintResult { - /// The number of files that were linted. - pub number_of_files: usize, - /// The number of warnings that were found. - pub number_of_warnings: usize, - /// The number of errors that were found. - pub number_of_errors: usize, + InvalidOptions { + message: String, + }, + PathNotFound { + paths: Vec, + }, /// The exit unix code for, in general 0 or 1 (from `--deny-warnings` or `--max-warnings` for example) - pub exit_code: ExitCode, + LintResult(ExitCode), + PrintConfigResult, + ConfigFileInitResult { + message: String, + }, } impl Termination for CliRunResult { @@ -39,12 +33,7 @@ impl Termination for CliRunResult { println!("Path {paths:?} does not exist."); ExitCode::from(1) } - Self::LintResult(LintResult { - number_of_files: _, // ToDo: only for tests, make snapshots - number_of_warnings: _, // ToDo: only for tests, make snapshots - number_of_errors: _, - exit_code, - }) => exit_code, + Self::LintResult(exit_code) => exit_code, Self::ConfigFileInitResult { message } => { println!("{message}"); ExitCode::from(0)