empty-when
What it does
Section titled “What it does”Reports a when with no statements and no comment.
Why it matters
Section titled “Why it matters”An empty when does nothing for that value, which usually means the code was never written, and it does not fall through to the next branch in Ruby.
To fix, write the body, or add a comment that says that nothing is meant to happen.
Example
Section titled “Example”... x...case xwhen 1when 2 then zendbegin...Configuration
Section titled “Configuration”ruby: lint: rules: empty-when: warn # off (default), warn, errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line empty-when in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| rubocop | Lint/EmptyWhen |
full |