【发布时间】:2014-10-22 13:38:22
【问题描述】:
我想为VisualEditor 存储库运行RuboCop。目前,我可以在存储库中找到的唯一 Ruby 文件是 .docs/CustomTags.rb。
$ find . | grep rb
./.docs/CustomTags.rb
如果我只运行rubocop,它不会找到任何文件:
$ rubocop
Inspecting 0 files
0 files inspected, no offenses detected
我猜它会忽略以点 (.docs) 开头的文件夹中的文件。
including files 上的 RuboCop 文档说:
如果您希望它检查其他文件,您需要手动传递 或在 AllCops/Include 下为它们添加条目。
如果我从命令行提供文件的路径,RuboCop 会找到该文件:
$ rubocop .docs/CustomTags.rb
Inspecting 1 file
W
(...)
1 file inspected, 26 offenses detected
我们的持续集成只是为存储库运行rubocop,所以我无法从命令行提供文件的路径。我必须使用AllCops/Include,但我不知道该怎么做。
如果我在存储库的根目录中创建.rubocop.yml:
AllCops:
Include:
- '.docs/CustomTags.rb'
然后运行 Rubocop,它没有找到该文件:
$ rubocop
Inspecting 0 files
0 files inspected, no offenses detected
我尝试了.rubocop.yml 文件的几种变体,包括:
AllCops:
Include:
- '**/CustomTags.rb'
和
AllCops:
Include:
- '.docs/**/*'
但他们都没有找到文件。
【问题讨论】: