Refactor: Source#correct -> Source#correct?

This commit is contained in:
Sijawusz Pur Rahnama 2022-12-20 14:53:23 +01:00
parent 4e3caf2986
commit 206b5ab604
3 changed files with 4 additions and 4 deletions

View file

@ -130,7 +130,7 @@ module Ameba
rule.test(source)
end
check_unneeded_directives(source)
break unless autocorrect? && source.correct
break unless autocorrect? && source.correct?
# The issues that couldn't be corrected will be found again so we
# only keep the corrected ones in order to avoid duplicate reporting.

View file

@ -24,7 +24,7 @@ module Ameba
# Corrects any correctable issues and updates `code`.
# Returns `false` if no issues were corrected.
def correct
def correct?
corrector = Corrector.new(code)
issues.each(&.correct(corrector))

View file

@ -129,7 +129,7 @@ module Ameba::Spec::ExpectIssue
end
def expect_correction(source, correction, *, file = __FILE__, line = __LINE__)
raise "Use `expect_no_corrections` if the code will not change" unless source.correct
raise "Use `expect_no_corrections` if the code will not change" unless source.correct?
return if correction == source.code
fail <<-MSG, file, line
@ -144,7 +144,7 @@ module Ameba::Spec::ExpectIssue
end
def expect_no_corrections(source, *, file = __FILE__, line = __LINE__)
return unless source.correct
return unless source.correct?
fail <<-MSG, file, line
Expected no corrections, but got: