Add autocorrect for Style/UnlessElse

This commit is contained in:
fn ⌃ ⌥ 2022-12-19 06:27:20 -08:00
parent e6ebca7a5b
commit d7795c0d7d
5 changed files with 122 additions and 2 deletions

View file

@ -13,7 +13,7 @@ module Ameba::Rule::Style
end
it "fails if unless has else" do
expect_issue subject, <<-CRYSTAL
source = expect_issue subject, <<-CRYSTAL
unless something
# ^^^^^^^^^^^^^^ error: Favour if over unless with else
:one
@ -21,6 +21,14 @@ module Ameba::Rule::Style
:two
end
CRYSTAL
expect_correction source, <<-CRYSTAL
if something
:two
else
:one
end
CRYSTAL
end
it "reports rule, pos and message" do