So we run a code quality tool called reek once in a while as part of our project. The tool basically looks for code smells and reports them. Here, we observed that we get "Duplication" smell every time we try to access a key in params
more than once (As if we are making a method-call twice with same parameters or we are duplicating an if condition etc). However, params
is just a Hash
, right? Other hashes don't get duplication smell when their keys are accessed more than once.
Why is this so? What are params
exactly? Does it make sense to cache params
in a local variable then use them? Will it help or its the same? Or is there something wrong with the tool? Help!