Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(linter): move default all_rules output to trait #8710

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/checkstyle.rs
Original file line number Diff line number Diff line change
@@ -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())
}
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/github.rs
Original file line number Diff line number Diff line change
@@ -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)
}
4 changes: 3 additions & 1 deletion apps/oxlint/src/output_formatter/mod.rs
Original file line number Diff line number Diff line change
@@ -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> {
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/stylish.rs
Original file line number Diff line number Diff line change
@@ -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())
}
4 changes: 0 additions & 4 deletions apps/oxlint/src/output_formatter/unix.rs
Original file line number Diff line number Diff line change
@@ -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())
}