使用 Travis CI 运行 rubocop 时不断出错

1 ruby continuous-integration ruby-on-rails travis-ci rubocop

我无法弄清楚这个错误来自哪里。实际的 rubocop 文件中没有 AlignWith 参数。将不胜感激任何提示。rubocop.yml 和 travis 文件的错误和副本如下。谢谢你。

错误:在 /home/travis/build/firehosefirechess/chess_app/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.rubocop.ymlAlignWith中找到的过时参数 AlignWith(用于 Lint/EndAlignment) 已重命名为EnforcedStyleAlignWith

.rubocop.yml

Documentation:

  Enabled: false

EndOfLine:

  Enabled: false

AllCops:

  Include:

    - '**/Rakefile'
    - '**/config.ru'
    - '**/Gemfile'
  Exclude:
    - 'db/**/*'
    - 'config/**/*'
    - 'script/**/*'
    - !ruby/regexp /old_and_unused\.rb$/

Lint/EndAlignment:
  EnforcedStyleAlignWith: variable

Style/Encoding:
  Enabled: false

Metrics/LineLength:
  Max: 99

Metrics/BlockLength:
  Enabled: false

UnusedBlockArgument:
  Description: 'Checks for unused block arguments.'
  Enabled: false

Style/EmptyLines:
  Enabled: false

Style/TrailingBlankLines:
  Enabled: false

**travis.yml**

language: ruby

cache: bundler

rvm:
- 2.4.1

before_script:

 - bundle exec rake db:create db:migrate db:seed

script:

- bundle exec rubocop

services:

- postgresql
Run Code Online (Sandbox Code Playgroud)

小智 7

仔细看一下错误:

Error: obsolete parameter AlignWith (for Lint/EndAlignment) found in /home/travis/build/firehosefirechess/chess_app/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.rubocop.yml AlignWith has been renamed to EnforcedStyleAlignWith
Run Code Online (Sandbox Code Playgroud)

显示错误的不是您的应用程序的 .rubocop.yml,它实际上在chess_app/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.rubocop.yml!

由于您可能不想在供应商代码上运行 Rubocop,您可以通过Exclude在您自己的配置中的列表中添加一行来解决此问题:

- 'vendor/**/*'