为什么我的本地项目中有很多罪行,而我的队友没有任何罪行?
我们在项目中使用RuboCop,问题是当我使用Rubocop时,我会遇到182次进攻,而同一分支中的队友也没有得到任何攻击,我们拥有相同的Ruby,Rails和Rubocop版本。
spec/rails_helper.rb:45:4: C: [Correctable] Style/FetchEnvVar: Use ENV.fetch("RAILS_ENV") or ENV.fetch("RAILS_ENV", nil) instead of ENV["RAILS_ENV"].
if ENV["RAILS_ENV"] == "test"
我遇到的犯罪的一个例子。
Rubocop V:1.28.2 Rails V:6.0.3.4 Ruby V:2.7.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.rubocop_todo.yml 文件过滤掉列表rubocop罪行。
如果您的队友有一个,而您没有,或者您有此文件的不同版本,则Rubocop将标记不同的罪行。
.rubocop_todo.yml files filter out a list Rubocop offenses.
If your teammates have one and you do not, or if you have a different version of this file, then different offenses will be flagged by Rubocop.
https://docs.rubocop.org/rubocop/configuration.html#automatically-generated-configuration
影响RuboCop的因素只有两个因素:Rubocop Gem版本和.rubocop.yml配置。
您可以运行
rubocop -debug
以查看有关配置的更多详细信息。There are only two factors influencing rubocop: rubocop gem version and .rubocop.yml configuration.
You can run
rubocop --debug
to see more details about configuration which is used.