Skip to content

Enable RuboCop for migrations

username-removed-443319 requested to merge enable-rubocop-for-migrations into master

What does this MR do?

Enable RuboCop for all files inside db/migrate, then add magic comments to all existing files, so that this only affects new migrations.

Are there points in the code the reviewer needs to double check?

This entire change is a config change and a bunch of comments.

Why was this MR needed?

Yorick Peterse [11:55 AM]  
I don't think we have any use case for nested def, might as well blacklist it

Sean McGivern [11:57 AM]  
http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/NestedMethodDefinition

Sean McGivern [11:57 AM]  
hmm, it's already enabled

Sean McGivern [11:57 AM]  
... because we exclude `db/` from rubocop :slightly_smiling_face:

Douwe Maan [11:57 AM]  
@smcgivern: heh

Sean McGivern [11:59 AM]  
I guess that's because we don't want to change the old migrations? I wonder if it's worth enabling it and adding magic comments to all the previous ones to ignore rubocop

Douwe Maan [11:59 AM]  
@smcgivern: agreed

What are the relevant issue numbers?

None.

Screenshots (if relevant)

None, but if I remove the magic comment from the migration 20160416182152_convert_award_note_to_emoji_award.rb I get:

$ be rubocop
Inspecting 1959 files
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................W....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Offenses:

db/migrate/20160416182152_convert_award_note_to_emoji_award.rb:3:5: W: Lint/NestedMethodDefinition: Method definitions must not be nested. Use lambda instead.
    def up ...
    ^^^^^^

1959 files inspected, 1 offense detected

Does this MR meet the acceptance criteria?

Merge request reports