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

Fix Violations of and Reenable Style/HashTransformValues and Style/HashTransformKeys #58453

Merged
merged 2 commits into from May 13, 2024

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented May 7, 2024

These are both pretty straightforward:

Looks for uses of _.each_with_object({}) …, _.map ….to_h, and Hash[_.map …] that are actually just transforming the keys/values of a hash, and tries to use a simpler & faster call to transform_keys/transform_values instead.

TIL that these methods exist!

Changes applied automatically with

bundle exec rubocop --autocorrect-all --only Style/HashTransformKeys
bundle exec rubocop --autocorrect-all --only Style/HashTransformValues

Changes seem straightforward and safe, and look consistently like clear improvements to me. Please let me know if you disagree, but this one seems like an easy win!

Links

Testing story

Relying on existing tests to verify that none of these changes result in any difference to functionality.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@Hamms Hamms marked this pull request as ready for review May 7, 2024 22:35
@Hamms Hamms requested a review from a team as a code owner May 7, 2024 22:35
@Hamms Hamms requested a review from a team May 7, 2024 22:35
Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the autocorrect option is a nice confidence boost!

Copy link
Contributor

@wilkie wilkie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@Hamms Hamms merged commit f09898e into staging May 13, 2024
2 checks passed
@Hamms Hamms deleted the fix-Style/HashTransformValues branch May 13, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants