Getting rid of FeatureEnvy when dealing with data in a method

83 Views Asked by At

I'm often encountering methods where the handling of data is necessary in order to achieve certain process, in general something like:

def process_something(data_from_external_service)
  request_params = {
    param1: data_from_external_service['param1'],
    param2: data_from_external_service['param2'],
    param3: data_from_external_service['param3']
  }
  post_action('some other service param', request_params)
end

Considering that:

  1. The post action is logically expected to be inside that method (also handling that data), and doing the params preparation somewhere else would probably raise the same reek in the other method that calls process_something.
  2. data_from_external_service is precisely that, those are values coming from outside the app, and creating a new class just to handle that set of data seems to me an excessive measure.

Is there a "legal" way of getting rid of the FeatureEnvy reek?. The only thing I'm doing now is adding # :reek:FeatureEnvy on top of the method.

0

There are 0 best solutions below