-
-
Notifications
You must be signed in to change notification settings - Fork 279
Open
Description
In our app, I noticed a lot of unnecessary usage of the mentioned methods when we can just rewrite the hash definition (or the hash is already having the right format, so method call is not needed).
# bad
SomeJob.perform_async({ foo: 1, bar: 2 }.stringify_keys)
# good
SomeJob.perform_async({ "foo" => 1, "bar" => 2 })
I was also able to find a few offences in OSS projects, for example gitlab.
1 offense for symbolize_keys
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/instrumentation/redis_payload.rb#L22-29
and 54 offenses for stringify_keys
like https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/lfs_download_object.rb#L23-28
vlad-pisanov
Metadata
Metadata
Assignees
Labels
No labels