简体   繁体   English

Rails配置Rubocop

[英]Rails configure rubocop

I am using pre-commit and rubocop gem in a rails 4 application. 我在Rails 4应用程序中使用pre-commit和rubocop gem。 I would like to escape quote checks which result in errors like Prefer single-quoted strings when you don't need string interpolation or special symbols. 我想避免使用引号检查, Prefer single-quoted strings when you don't need string interpolation or special symbols. ,会导致诸如“ Prefer single-quoted strings when you don't need string interpolation or special symbols.类的错误Prefer single-quoted strings when you don't need string interpolation or special symbols.

This is what i have already tried in .rubocop.yml but it doesn't have the effect that I want. 这是我已经在.rubocop.yml中尝试过的方法,但没有达到我想要的效果。

Style/StringLiterals:
 Enabled: false
Style/UnneededPercentQ:
 Enabled: false

you could try: 您可以尝试:

Style/StringLiterals:
  EnforcedStyle: double_quotes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM