Rubocop:Rubocop在“ .ruby-version”中发现了未知Ruby 3.1版

发布于 2025-01-19 19:37:28 字数 659 浏览 3 评论 0 原文

我最近将 ruby​​ 版本从 2.7.5 升级到 3.1.1,当我尝试运行 rubocop 时,出现错误 Error: RuboCop 在 .ruby-version 中发现未知的 Ruby 版本 3.1 <代码>。支持的版本:2.3、2.4、2.5、2.6、2.7 查看 rubocop 兼容性 文档,它支持 3.1 版本。知道我为什么会收到错误吗?

.rubocop.yml:

require: rubocop-rspec
AllCops:
  Exclude:
    - 'bin/*'
    - 'vendor/**/*'
Metrics/BlockLength:
  Exclude:
    - 'spec/**/*'
Metrics/LineLength:
  Exclude:
    - 'spec/**/*'
RSpec/AnyInstance:
  Enabled: false
RSpec/ExampleLength:
  Exclude:
    - 'spec/**/*'
Style/BracesAroundHashParameters:
  Enabled: false

I recently upgraded ruby version from 2.7.5 to 3.1.1 and when I try to run rubocop I get error Error: RuboCop found unknown Ruby version 3.1 in .ruby-version. Supported versions: 2.3, 2.4, 2.5, 2.6, 2.7
Looking at the rubocop compatibility documentation it supports 3.1 version. Any idea why I am getting the error?

.rubocop.yml:

require: rubocop-rspec
AllCops:
  Exclude:
    - 'bin/*'
    - 'vendor/**/*'
Metrics/BlockLength:
  Exclude:
    - 'spec/**/*'
Metrics/LineLength:
  Exclude:
    - 'spec/**/*'
RSpec/AnyInstance:
  Enabled: false
RSpec/ExampleLength:
  Exclude:
    - 'spec/**/*'
Style/BracesAroundHashParameters:
  Enabled: false

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒一口袋星星 2025-01-26 19:37:28

Rubocop版本 0.77.0 不支持最新的Ruby版本。请确保使用较新的RuboCop:

gem install rubocop -v 1.14.0

您可以检查 lib/rubocop/target_ruby.rb file, nown> nown_rubies const中的RuboCop版本支持哪些Ruby版本。

E. g。 RuboCop版本1.14.0版的支持的Ruby版本:

Rubocop version 0.77.0 doesn't support newest ruby versions. Make sure to use newer rubocop:

gem install rubocop -v 1.14.0

You can check what ruby versions are supported by which rubocop version in lib/rubocop/target_ruby.rb file, KNOWN_RUBIES const.

E. g. supported ruby versions for rubocop version 1.14.0: https://github.com/rubocop/rubocop/blob/v1.14.0/lib/rubocop/target_ruby.rb#L7

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文