struct Ameba::Rules::UnlessElse
- Ameba::Rules::UnlessElse
- Ameba::Rule
- Struct
- Value
- Object
Overview
A rule that disallows the use of an else
block with the unless
.
For example, the rule considers these valid:
unless something
:ok
end
if something
:one
else
:two
end
But it considers this one invalid as it is an unless
with an else
:
unless something
:one
else
:two
end
The solution is to swap the order of the blocks, and change the unless
to
an if
, so the previous invalid example would become this:
if something
:two
else
:one
end
Defined in:
ameba/rules/unless_else.crInstance Method Summary
Instance methods inherited from struct Ameba::Rule
catch(source : Source)
catch,
initialize
initialize,
name
name,
test(source : Source, node : Crystal::ASTNode)test(source : Source) test