And*_*vey 6 ruby-on-rails rubocop
在 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.
Run Code Online (Sandbox Code Playgroud)
这是来自Rubocop。
我知道 Rubocop 检查应用程序根目录中是否存在 .ruby-version 文件并使用它指定的 Ruby 版本。https://rubocop.readthedocs.io/en/latest/configuration/#setting-the-target-ruby-version
Rails 应用程序包含这样一个文件
/.ruby-version
ruby-2.5.3
Run Code Online (Sandbox Code Playgroud)
为什么 Rubocop 会针对错误的 Ruby 版本运行检查?
它来自parser ,这是rubocop的依赖项。
https://github.com/whitequark/parser/blob/master/lib/parser/current.rb
看看这段代码,如果您没有使用 Ruby 的最后一个小版本,您就会收到此警告。
| 归档时间: |
|
| 查看次数: |
2526 次 |
| 最近记录: |