rubocop-rails
rubocop-rails copied to clipboard
Add new `Rails/ForeignKeyName` cop
https://rails.rubystyle.guide/#meaningful-foreign-key-naming
It's been a while 😄
@pirj, thank you for suggestions! I addressed all of them, please take a look.
@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?
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.
Updated.