Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Dec 19, 2023
1 parent d87c48f commit 9749386
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,19 @@ impl Linter {
self.lint_program(parsed_source)
}

fn filter_diagnostics(&self, mut context: Context) -> Vec<LintDiagnostic> {
let _mark = PerformanceMark::new("Linter::filter_diagnostics");
fn collect_diagnostics(&self, mut context: Context) -> Vec<LintDiagnostic> {
let _mark = PerformanceMark::new("Linter::collect_diagnostics");

let mut filtered_diagnostics = context.check_ignore_directive_usage();
let mut diagnostics = context.check_ignore_directive_usage();
// Run `ban-unknown-rule-code`
filtered_diagnostics.extend(context.ban_unknown_rule_code());
diagnostics.extend(context.ban_unknown_rule_code());
// Run `ban-unused-ignore`
filtered_diagnostics.extend(context.ban_unused_ignore(&self.ctx.rules));
filtered_diagnostics.sort_by_key(|d| d.range.start.line_index);
diagnostics.extend(context.ban_unused_ignore(&self.ctx.rules));

filtered_diagnostics
// Finally sort by line the diagnostics originates on
diagnostics.sort_by_key(|d| d.range.start.line_index);

diagnostics
}

fn lint_program(
Expand Down Expand Up @@ -193,7 +195,7 @@ impl Linter {
rule.lint_program_with_ast_view(&mut context, pg);
}

self.filter_diagnostics(context)
self.collect_diagnostics(context)
});

diagnostics
Expand Down

0 comments on commit 9749386

Please sign in to comment.