Rubocop, how to Disable/Enable cops on blocks of code

I answer my question because it is always very difficult for me to find the reference to this solution:

# rubocop:disable Metrics/MethodLength
def my_code
  ..
end
# rubocop:enable Metrics/MethodLength

Same for multiple cops:

# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def my_code
  ..
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength

Documentation: https://docs.rubocop.org/rubocop/configuration.html#disabling-cops-within-source-code

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)