crystal-ameba / ameba

A static code analysis tool for Crystal
https://crystal-ameba.github.io
MIT License
521 stars 38 forks source link

Fix severity type for YAML converter spec #366

Closed straight-shoota closed 1 year ago

straight-shoota commented 1 year ago

The return type of SeverityYamlConverter.from_yaml is Severity?, but the implementation of YAML::Serializable previously swallowed Nil values. This was recently fixed in https://github.com/crystal-lang/crystal/pull/13238, so now the compiler complains about assigning a value of type Severity? to an ivar typed Severity (https://github.com/crystal-ameba/ameba/actions/runs/4592466318/jobs/8109527429#step:5:24).

This is only a minimal fix to make the spec succeed. But it might be a good idea to change something about that Nil type. I don't think it really even works to have a Nil severity.