mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor: Source#correct
-> Source#correct?
This commit is contained in:
parent
4e3caf2986
commit
206b5ab604
3 changed files with 4 additions and 4 deletions
|
@ -130,7 +130,7 @@ module Ameba
|
||||||
rule.test(source)
|
rule.test(source)
|
||||||
end
|
end
|
||||||
check_unneeded_directives(source)
|
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
|
# The issues that couldn't be corrected will be found again so we
|
||||||
# only keep the corrected ones in order to avoid duplicate reporting.
|
# only keep the corrected ones in order to avoid duplicate reporting.
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Ameba
|
||||||
|
|
||||||
# Corrects any correctable issues and updates `code`.
|
# Corrects any correctable issues and updates `code`.
|
||||||
# Returns `false` if no issues were corrected.
|
# Returns `false` if no issues were corrected.
|
||||||
def correct
|
def correct?
|
||||||
corrector = Corrector.new(code)
|
corrector = Corrector.new(code)
|
||||||
issues.each(&.correct(corrector))
|
issues.each(&.correct(corrector))
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ module Ameba::Spec::ExpectIssue
|
||||||
end
|
end
|
||||||
|
|
||||||
def expect_correction(source, correction, *, file = __FILE__, line = __LINE__)
|
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
|
return if correction == source.code
|
||||||
|
|
||||||
fail <<-MSG, file, line
|
fail <<-MSG, file, line
|
||||||
|
@ -144,7 +144,7 @@ module Ameba::Spec::ExpectIssue
|
||||||
end
|
end
|
||||||
|
|
||||||
def expect_no_corrections(source, *, file = __FILE__, line = __LINE__)
|
def expect_no_corrections(source, *, file = __FILE__, line = __LINE__)
|
||||||
return unless source.correct
|
return unless source.correct?
|
||||||
|
|
||||||
fail <<-MSG, file, line
|
fail <<-MSG, file, line
|
||||||
Expected no corrections, but got:
|
Expected no corrections, but got:
|
||||||
|
|
Loading…
Reference in a new issue