RuboCop:线太长←如何忽略? [英] RuboCop: Line is too long ← How to Ignore?

查看:89
本文介绍了RuboCop:线太长←如何忽略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将RuboCop添加到Rails项目中,并安装了Sublime软件包,以在编辑器中查看RuboCop的建议.我试图弄清楚如何从80个字符中更改最大行长,或者只是完全忽略该规则.

I just added RuboCop to a rails project and installed the Sublime package to see RuboCop suggestions in the editor. I'm trying to figure out how to change the maximum line length from 80 characters, or just ignore the rule completely.

当前正在使用:

  • RuboCop (gem)
  • Sublime RuboCop
  • SublimeLinter-rubocop

推荐答案

在您的代码中,您可以禁用以下几行代码:

In your code, you can disable a bunch of lines like this:

# rubocop:disable LineLength
puts "This line is lonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnng"
# rubocop:enable LineLength

或将其添加到您的.rubocop.yml文件中以增加最大长度:

Or add this to your .rubocop.yml file to increase the max length:

Metrics/LineLength:
  Max: 100

这篇关于RuboCop:线太长←如何忽略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆