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

A RuboCop extension focused on enforcing Rails best practices and coding conventions.

Results 281 rubocop-rails issues
Sort by recently updated
recently updated
newest added

As [@javierjulio](https://github.com/javierjulio) has noticed in [this PR](https://github.com/rubocop/rubocop-rails/pull/710#issuecomment-1158292510), rails/rails/pull/39453 was committed which seems to make this cop condition not applicable. Rails won't emit such deprecation if there is no write to...

Hi, people. I'm upgrading my project dependencies (including rubocop, rubocop-rails, etc.), and noted a new offense warning: `Rails/RedundantPresenceValidationOnBelongsTo`. My code: ```ruby class User < ApplicationRecord end class Post < ApplicationRecord...

Follow up https://github.com/rubocop/rubocop/pull/10829. This PR deprecates `IgnoredMethods` option in integrate to `AllowedMethods` and `AllowedPatterns` option. It requires RuboCop 1.33.0 or higher. ----------------- Before submitting the PR make sure the following...

Rails 6.1 changed how where.not works with multiple hash arguments. This cop identifies places where where.not is used with multiple hash arguments. It doesn't suggest corrections because depending on the...

See https://github.com/rubocop/rails-style-guide/pull/323 This cop is extracted from Shopify's internal Rubocop repository. Many thanks to the original authors for their work. ----------------- Before submitting the PR make sure the following are...

See https://github.com/rubocop/rails-style-guide/pull/323 This cop is extracted from Shopify's internal Rubocop repository. Many thanks to the original authors for their work. ----------------- Before submitting the PR make sure the following are...

This is an (as-yet) unimplemented cop that I propose for detecting duplicate entries in the `only` and `except` options of a controller action's callback. ```ruby # @example # # bad...

Closes #654 Currently, rails supports only single preview path: https://github.com/rails/rails/blob/af0733a8e7ceddf6b9128ad2aaf4f74c5b427c43/actionmailer/lib/action_mailer/railtie.rb#L28 In the future, this will change: https://github.com/rails/rails/pull/31595 So I created `PreviewPaths` config as an array.

Closes #555. Autocorrection is more involved, so I suggest to leave it as a future improvement. Tested on gitlab's codebase: a bunch of offenses, no errors.

See https://github.com/rubocop/rubocop-rails/discussions/672