我想只包含特定目录,并忽略其他所有目录。
这忽略了一切
AllCops:
Include:
- 'something/**/*.rb'
Exclude:
- '**/*'
这会检查一切
AllCops:
Include:
- 'something/**/*.rb'
appears,如果你定义Include
,Rubocop的最新版本(~0.56 +)将只包含Include
中指定的文件(或模式)。
这意味着如果您所做的只是:
AllCops:
Include:
- 'something/**/*.rb'
然后只会检查something/**/*.rb
。它会覆盖默认文件而不是附加到它。
我认为这是新功能,因为这就是它现在为我们所做的事情,而不是之前的事情。非常欺骗小版本发布。
正则表达似乎工作,但非常难看
AllCops:
Exclude:
- !ruby/regexp /^((?!(something|some\/other\/dir)).)*$/