rubocop

Need to refactor to the new Ruby 1.9 hash syntax [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-07 04:11:26
问题 This question already has an answer here : Hash syntax in Ruby [duplicate] (1 answer) Closed 2 years ago . I have a recipe that has the following code that is failing a lint test: service 'apache' do supports :status => true, :restart => true, :reload => true end It fails with the error: Use the new Ruby 1.9 hash syntax. supports :status => true, :restart => true, :reload => true Not sure what the new syntax looks like... can anyone please assist? 回答1: In the Ruby version 1.9 has been

Need to refactor to the new Ruby 1.9 hash syntax [duplicate]

风格不统一 提交于 2019-12-05 08:15:39
This question already has an answer here: Hash syntax in Ruby [duplicate] 1 answer I have a recipe that has the following code that is failing a lint test: service 'apache' do supports :status => true, :restart => true, :reload => true end It fails with the error: Use the new Ruby 1.9 hash syntax. supports :status => true, :restart => true, :reload => true Not sure what the new syntax looks like... can anyone please assist? In the Ruby version 1.9 has been introduced a new syntax for hash literals whose keys are symbols. Hashes use the "hash rocket" operator to separate the key and the value:

RuboCop: Line is too long <— How to Ignore

好久不见. 提交于 2019-12-02 15:42:04
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. Currently in use: 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 Or add this to your .rubocop.yml file to increase the

How to tell Rubocop to ignore a specific directory or file

冷暖自知 提交于 2019-11-30 13:34:30
问题 My project is extending open-source classes from a third-party gem that we don't want to hold to the same coding standards as our own code. Refactoring the gem code isn't a viable option. We just want Rubocop to ignore the copied code. How can I instruct Rubocop to completely ignore a file or directory? 回答1: As per orde's comment with the link to the manual I found .rubocop.yml and added the following: AllCops: Exclude: - 'path/to/excluded/file.rb' where the path is relative to .rubocop.yml

Rubocop Linelength: How to ignore lines with comments?

爷,独闯天下 提交于 2019-11-29 20:47:44
Using a Rails 4 app I would like Rubocop to ignore lines with comments (just a comment or some code with an end of line comment) when checking if a line is to long. Is there a way to do this? There is a way to ignore cops on a per line basis. There is also a way to do it via configuration file. Run rubocop --auto-gen-config and it will generate a file that you can use to disable the offenses. The command also gives a hint on what to do to load those options. On a line per line basis, you can enable and disable the cops as well. # rubocop:disable RuleByName This is a long line # rubocop:enable

RuboCop: Line is too long <— How to Ignore

给你一囗甜甜゛ 提交于 2019-11-27 10:04:22
问题 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. Currently in use: RuboCop (gem) Sublime RuboCop SublimeLinter-rubocop 回答1: In your code, you can disable a bunch of lines like this: # rubocop:disable LineLength puts "This line is