You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
Basically, these would be offenses if I understand you:
{foo: 1,"bar"=>2}.stringify_keys# => all keys are known, just stringify yourself{foo: 1,"bar"=>2}.symbolize_keys# => and the same, in the opposite direction
Principally I agree. I can especially see how someone would add symbolize_keys to that one example you linked since the keys to look rather string-like.
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).
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-29and 54 offenses for
stringify_keys
like https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/lfs_download_object.rb#L23-28The text was updated successfully, but these errors were encountered: