[英]Rubocop: Ignore all cops that are boilerplate from a new rails app
When I run rubocop
in my app directory, I get a long list of cops that stem from the default boiler-plate rails app which I just generated. 当我在我的应用程序目录中运行rubocop
时,我会得到一长串警察,这些警察源于我刚生成的默认样板轨道应用程序。
I don't want rubocop to look at these files since I'm not the author of the files and I don't want to mess around with them. 我不希望rubocop查看这些文件,因为我不是这些文件的作者,而且我也不想弄乱它们。
I see that I can add files to the Exclude:
section with rubocop/config/default.yml
but I'm not sure what configs and files I should be adding to properly ignore the built in files while not ignoring the files I create. 我看到可以使用rubocop/config/default.yml
将文件添加到“ Exclude:
部分,但是我不确定应该添加哪些配置和文件以正确忽略内置文件,而不忽略我创建的文件。
You can run rubocop --auto-gen-config
and this will create a todo file for you which you can disable all the cops in. Then you can selectively turn the ones you want back on. 您可以运行rubocop --auto-gen-config
,这将为您创建一个待办事项文件,您可以禁用所有警察。然后您可以有选择地重新打开想要的警察。 Alternatively you can create a boiler plate rails app and run rubocop and those will be the files you need to add the excludes list. 另外,您可以创建一个样板应用程序并运行rubocop,这些将是您添加排除列表所需的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.