在 RuboCop 中,错误严重性和致命严重性之间有什么区别?

In RuboCop, what's the difference between error and fatal severities?

RuboCop 中 "error" 和 "fatal" 的严重性有什么区别?

关于 severity 的文档说

Each cop has a default severity level based on which department it belongs to. The level is warning for Lint and convention for all the others. Cops can customize their severity level. Allowed params are refactor, convention, warning, error and fatal.

There is one exception from the general rule above and that is Lint/Syntax, a special cop that checks for syntax errors before the other cops are invoked. It can not be disabled and its severity (fatal) can not be changed in configuration.

这表明致命比错误更严重,但我可以编写无效的代码 ruby,它只会产生 "error" 级别的攻击。

def foo
  42
# No end

$ rubocop -D invalid.rb 
Inspecting 1 file
E

Offenses:

invalid.rb:3:11: E: unexpected token $end
# No end


1 file inspected, 1 offense detected

rubocop 消息来源表明,编码问题是唯一可能导致致命结果的问题。如果你在 rubocop github 上搜索 "fatal",你会看到很少的提及,如果你跟踪它的调用位置,基本上就是这样。