Add autocorrect checks to Flycheck, JSON, and TODO formatters

This commit is contained in:
fn ⌃ ⌥ 2021-10-26 21:46:16 -07:00
parent 749c53527e
commit 8d3b76003e
3 changed files with 3 additions and 0 deletions

View file

@ -5,6 +5,7 @@ module Ameba::Formatter
def source_finished(source : Source)
source.issues.each do |e|
next if e.disabled?
next if e.correctable? && config[:autocorrect]?
if loc = e.location
@mutex.synchronize do
output.printf "%s:%d:%d: %s: [%s] %s\n",

View file

@ -77,6 +77,7 @@ module Ameba::Formatter
source.issues.each do |e|
next if e.disabled?
next if e.correctable? && config[:autocorrect]?
json_source.issues << AsJSON::Issue.new(e.rule.name, e.rule.severity.to_s, e.location, e.end_location, e.message)
@result.summary.issues_count += 1
end

View file

@ -42,6 +42,7 @@ module Ameba::Formatter
Hash(Rule::Base, Array(Issue)).new.tap do |h|
issues.each do |issue|
next if issue.disabled? || issue.rule.is_a?(Rule::Lint::Syntax)
next if issue.correctable? && config[:autocorrect]?
(h[issue.rule] ||= Array(Issue).new) << issue
end
end