报告不包含 else 块的 case 语句。 else 块应始终存在,以指定 未找到匹配项时的默认结果。

示例:

# 不良做法
case status
when :active
  perform_action
end
可通过快速修复来插入 else 块。 应用快速修复后,结果如下所示:
# 优良做法
case status
when :active
  perform_action
else
  # 此处键入代码
end

'Roodi' 启发