Rubocop 不突出显示未定义的变量吗?

Does Rubocop not highlight undefined variables?

我已经为我的 IDE(Neovim - 使用 CoC 扩展)安装了 Solargraph(使用 Rubocop)。正在显示 Rubocop 警告,但直到 运行 我的 ruby 文件才检测到 NameErrors。这是默认行为,还是我需要做更多的配置?

我正在使用 Ruby 2.7.2(带有 rbenv)。

如果您知道答案,请提前致谢 - 如果需要,我可以提供更多详细信息。

简单回答:No. Because rubocop does not run your ruby code, it just parses the files. 所以,你有责任先让你的代码工作,然后用 Rubocop 修复样式 :)

小提示:you can create a github action to run both rubocop and your code on push/deploy

干杯!