rubocop-rails icon indicating copy to clipboard operation
rubocop-rails copied to clipboard

Add new `Rails/ForeignKeyName` cop

Open fatkodima opened this issue 4 years ago • 4 comments

https://rails.rubystyle.guide/#meaningful-foreign-key-naming

fatkodima avatar Jun 28 '20 20:06 fatkodima

It's been a while 😄

@pirj, thank you for suggestions! I addressed all of them, please take a look.

fatkodima avatar Nov 14 '21 22:11 fatkodima

@fatkodima Do you think it makes sense to run the new cop against https://github.com/eliotsykes/real-world-rails to check if there are errors, and check for false positives? I can do this for you, as it's a tedious task.

@koic Will you please take a look?

pirj avatar Nov 15 '21 08:11 pirj

Do you think it makes sense to run the new cop against https://github.com/eliotsykes/real-world-rails to check if there are errors, and check for false positives?

👍 I ran it on gitlab's codebase. Got 1 error, fixed it. For other migration files - seems like is working as expected.

One concern I have about this cop is that once introduced, it will start flagging old migrations.

I added a new option to be able to ignore old migrations. I think, it will be also useful for other existing cops, like AddColumnIndex or CreateTableWithTimestamps, etc.

fatkodima avatar Nov 15 '21 17:11 fatkodima

Updated.

fatkodima avatar Dec 25 '21 14:12 fatkodima