Home > database >  Rubocop finds an offense on a migration change method
Rubocop finds an offense on a migration change method

Time:10-31

On my migration file I have a number of new fields creation.

create_table :mytable do |t|
  t.string :my_field, null: false
  .........

And I am getting the following

 Metrics/AbcSize: Assignment Branch Condition size for change is too high. [<1, 17, 0> 17.03/17]

What is the proper way to avoid that?

CodePudding user response:

It's a common practice to exclude the db folder in your .rubocop.yml.

AllCops:
  Exclude:
    - 'db/**/*'

CodePudding user response:

Most of the time we Ignore ./db folder in rubocp.yml file. Other than that we can disable cops for a specific block of code. Here is the answer Rubocop, how to Disable/Enable cops on blocks of code

  • Related