Skip to content

Commit

Permalink
refactor(linter): move default all_rules output to trait (#8710)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Jan 25, 2025
1 parent 33de70a commit 4a2f2a9
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/checkstyle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ use crate::output_formatter::InternalFormatter;
pub struct CheckStyleOutputFormatter;

impl InternalFormatter for CheckStyleOutputFormatter {
fn all_rules(&self) -> Option<String> {
None
}

fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
Box::new(CheckstyleReporter::default())
}
Expand Down
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ use crate::output_formatter::InternalFormatter;
pub struct GithubOutputFormatter;

impl InternalFormatter for GithubOutputFormatter {
fn all_rules(&self) -> Option<String> {
None
}

fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
Box::new(GithubReporter)
}
Expand Down
4 changes: 3 additions & 1 deletion apps/oxlint/src/output_formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ pub struct LintCommandInfo {
/// The Formatter is then managed by [`OutputFormatter`].
trait InternalFormatter {
/// Print all available rules by oxlint
fn all_rules(&self) -> Option<String>;
fn all_rules(&self) -> Option<String> {
None
}

/// At the end of the Lint command the Formatter can output extra information.
fn lint_command_info(&self, _lint_command_info: &LintCommandInfo) -> Option<String> {
Expand Down
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/stylish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ use crate::output_formatter::InternalFormatter;
pub struct StylishOutputFormatter;

impl InternalFormatter for StylishOutputFormatter {
fn all_rules(&self) -> Option<String> {
None
}

fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
Box::new(StylishReporter::default())
}
Expand Down
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ use crate::output_formatter::InternalFormatter;
pub struct UnixOutputFormatter;

impl InternalFormatter for UnixOutputFormatter {
fn all_rules(&self) -> Option<String> {
None
}

fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
Box::new(UnixReporter::default())
}
Expand Down

0 comments on commit 4a2f2a9

Please sign in to comment.