2

我想为VisualEditor存储库运行RuboCop。目前,我可以在存储库中找到的唯一 Ruby 文件是.docs/CustomTags.rb

$ find . | grep rb
./.docs/CustomTags.rb

如果我只运行rubocop,它不会找到任何文件:

$ rubocop
Inspecting 0 files
0 files inspected, no offenses detected

.docs我猜它会忽略以点( )开头的文件夹中的文件。

关于包含文件的 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/**/*'

但是他们都没有找到该文件。

4

1 回答 1

2

这是RuboCop 中的一个错误。它现在已修复,但尚未发布带有修复的 gem。

于 2014-11-04T14:59:35.867 回答