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

This commit is contained in:
Sysix 2025-01-25 13:42:20 +00:00
parent 33de70ae71
commit 4a2f2a9cd9
5 changed files with 3 additions and 17 deletions

View file

@ -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())
}

View file

@ -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)
}

View file

@ -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> {

View file

@ -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())
}

View file

@ -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())
}