Ameba 0.13.0 has been released
A very small release that supports Crystal 0.35.0 and eliminates the deprecation messages which are related to yaml serialization.
Check out the release notes to see a full scope of changes.
Move to YAML::Serializable
Each rule in Ameba can be serialized to YAML and deserialized back to the Crystal struct.
This is needed in order to give users an ability to configure the Ameba binary
using the configuration file .ameba.yml.
And in order to deserialize, Ameba used YAML.mapping
macro. And starting from Crystal 0.35.0 this macro is deprecated since there
is a better alternative which is the YAML::Serializable
module.
Starting from this release, Ameba uses YAML::Serializable. The older version
of Ameba still works with Crystal 0.35.0 however, users might see the
deprecation warning while compiling the binary.
New rules
Lint/BadDirective
This is a new rule that reports the incorrect comment directive for Ameba.
For example, the user can mistakenly add a directive to disable a rule that even doesn’t exist:
# ameba:disable BadRuleName
def foo
:bar
end
Now, such a comment directive above will be properly reported.
Style/IsANil
Crystal has two ways for checking the nil equality: .is_a?(Nil) and .nil?.
Since the second is much more concise and doing basically the same, now Ameba
disallows calls to .is_a?(Nil) in favor of .nil?.
This is considered bad:
var.is_a?(Nil)
And needs to be written as:
var.nil?