IAmAkittycatAMA
IAmAkittycatAMA

Reputation: 245

Disable Rubocop argument list length

Currently I'm getting feedback from Rubocop saying "Avoid parameter lists longer than 5 parameters."

What is the #Rubocop:disable command to disable this? I'm happy with the code having an extra argument so I don't want to change it.

Upvotes: 7

Views: 8915

Answers (3)

sofs1
sofs1

Reputation: 4176

# rubocop:disable Metrics/ParameterLists 

your function goes here

# rubocop:enable Metrics/ParameterLists

Upvotes: 4

DennyZhang
DennyZhang

Reputation: 362

For your convenience, here is my .rubocop.yml I frequently used.

See formal explanation of .rubocop.yml here.

AllCops:
  Excludes:
    - Berksfile
    - recipes/basic.rb
    - attributes/*.rb

# Customize rules
Metrics/LineLength:
  Max: 95

MethodLength:
  Max: 35

Metrics/AbcSize:
   Enabled: false

BlockLength:
  Max: 70

I constantly bump by rubocop errors and warning. Thus I've published this post.

Common Rubocop Errors: Improve Your Ruby Code Quality

Upvotes: 3

orien
orien

Reputation: 2210

You could drop a file named .rubocop.yml in your project root directory with the following content.

Metrics/ParameterLists:
  Enabled: false

Upvotes: 8

Related Questions