Skip to content
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

Make Rails/EagerEvaluationLogMessage enabled by default #1364

Conversation

Uaitt
Copy link
Contributor

@Uaitt Uaitt commented Sep 13, 2024

On issue #1355 we had some discussions about the Rails/EagerEvaluationLogMessage cop. In particular, @Earlopain did some useful benchmarks of some possible scenarios.

After seeing the benchmarks, it's pretty obvious to note that offenses that this cop reports (that is, interpolated strings passed to Rails.logger.debug ) are very slow compared to the form that the cop allows (that is, blocks passed to Rails.logger.debug).

With that being said, considering that the performance hit is now clear between the 2 forms, we might as well enable this cop by default.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@Uaitt Uaitt force-pushed the enable-Rails/EagerEvaluationLogMessage-by-default branch from 0b3ba39 to 69b6a57 Compare September 13, 2024 12:10
@Uaitt Uaitt force-pushed the enable-Rails/EagerEvaluationLogMessage-by-default branch from 69b6a57 to f787de2 Compare September 13, 2024 12:12
@Earlopain
Copy link
Contributor

Thanks, but cops aren't enabled in minor releases. If a user wants it right now, they must either use NewCops: enable or enable it manually. See https://docs.rubocop.org/rubocop/versioning.html#pending-cops

@koic
Copy link
Member

koic commented Sep 14, 2024

I'm going to close this proposal because newly introduced rules are not enabled by default until a major version update. Thank you.

@koic koic closed this Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants