【问题标题】:robocop.yml won't ignore files for code checkingrobocop.yml 不会忽略文件进行代码检查
【发布时间】:2019-04-23 18:06:05
【问题描述】:

我在我的 rails 应用程序上安装了 gem 'rubocop', '~> 0.67.2',现在我想向 rubocom.yml/Exclude 添加一些文件,这样 Rubocop 就不会跟踪它们。 我把它放在我的应用程序的根目录中

rubocop.yml

AllCops:
  Exclude:
  - 'db/**/*'
  - 'config/**/*'
  - 'script/**/*'
  - 'bin/{rails,rake}'

但当我在终端中运行“rubocop”命令时,这些文件仍显示为已跟踪。我错过了什么?

【问题讨论】:

    标签: ruby-on-rails rubocop


    【解决方案1】:

    我认为您的.yml 格式不正确,您需要对数组元素进行缩进,例如

    AllCops:
      Exclude:
        - 'db/**/*'
        - 'config/**/*'
        - 'script/**/*'
        - 'bin/{rails,rake}'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 2021-09-29
      • 2011-01-11
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 2022-07-24
      相关资源
      最近更新 更多