-
-
Notifications
You must be signed in to change notification settings - Fork 733
Fix Rubocop Rails issues #11482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @macanudo527 , I see you've started on this so created an issue for tracking. |
@dacook Can you assign this to me? |
Hi @macanudo527 , how have you been? I hope you've had a fulfilling start to the year! |
@dacook Yeah, I've just been too busy with everything. I'd like to work on it, but just can't. |
No problems, that's totally understandable. All the best for this season, and I hope to see you again soon! |
Great, yep, that's correct Anthony. Good luck! |
@dacook maybe we could create sub-issues of the task list in the description? We can create them as we go. Just click to the far right of each checkbox. |
Thanks Sigmund. Yes I hadn't bothered with this because I wasn't sure how big each of the items was. It's possible some are so small that they don't need to have a separate issue/pr.. |
…11482) - When you define a uniqueness validation in Active Record model, you also should add a unique index for the column. - Cf. https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsuniquevalidationwithoutindex - Therefore : migration files to match DB structure and Ruby code.
Hello @dacook , The Rails/SquishedSQLHeredocs item is not in the Regarding the Rails/TransactionExitStatement, the offense will no longer be effective in Rails 7.2 upwards since the behaviour that has changed will be restored. (I don't know how to tag this item). |
Thanks Cyrille, that's interesting, the list was last generated in 2024, I don't know why SquishedSQL was included then. 🤷 Thanks to your latest contribution, we're almost finished! |
…11482) - When you define a uniqueness validation in Active Record model, you also should add a unique index for the column. - Cf. https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsuniquevalidationwithoutindex - Therefore : migration files to match DB structure and Ruby code.
Hi @cyrillefr , just wondering if you are planning to do any further work on this? If so I will assign the issue to you to avoid double-up with anyone else. Edit: as you already have a PR open for this issue I've assigned you for now. |
Hello @dacook , The Rails/LexicallyScopedActionFilter box can be checked with a reference to #13251 instead :) That leaves this issue with the #13163 which is blocked and it will be done. |
We use Rubocop to standardise our code, which can improve code quality and reduce confusion. When evaluating each rule, consider if it helps with those goals or not. Often the suggested autocorrection is fine, but some cops require more consideration and there may be a better solution, or it might be appropriate to disable them, rather than create unnecessary extra work.
If unsure, please ping @openfoodfoundation/core-devs to request an opinion.
Strategy to fix issues
The normal process to fix a style issue is:
.rubocop_todo.yml
and run rubocop to see the error(s).rubocop:disable
comment in some cases (disable only offending line where possible)When a cop or group of cops is complete, open a pull request.
Issues
Most/all of these will require manual fixes.
Generated 27 Feb 2024, up to date as of 19 Mar 2025
Rails/TransactionExitStatement(redundant in Rails 7.2)The text was updated successfully, but these errors were encountered: