在 Rails 应用程序中,我开始在日志和测试输出中看到以下内容。
warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.5-compliant syntax, but you are running 2.5.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
这是来自Rubocop。
我知道 Rubocop 检查应用程序根目录中是否存在 .ruby-version 文件并使用它指定的 Ruby 版本。 https://rubocop.readthedocs.io/en/latest/configuration/#setting-the-target-ruby-version
Rails 应用程序包含这样一个文件
/.ruby-version
ruby-2.5.3
为什么 Rubocop 会针对错误的 Ruby 版本运行检查?
最佳答案
它来自解析器,是 rubocop 的依赖项。
https://github.com/whitequark/parser/blob/master/lib/parser/current.rb
查看此代码,似乎如果您没有使用 Ruby 的最后一个次要版本,则会收到此警告。
关于ruby-on-rails - 为什么 Rubocop 提高 “parser/current recognizes 2.5.5-compliant syntax, but you are running 2.5.3” ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56538359/