Rubocop: Call super to initialize state of the parent class even when super class doesn't have initialization

Viewed 3907

Out of nowhere, Rubocop is complaining about classes that are not calling super.

W: Lint/MissingSuper: Call `super` to initialize state of the parent class.

Example:

# frozen_string_literal: true

class ApplicationService
  class << self
    def call(*args)
      new(*args).call
    end
  end

  def initialize(_args)
    raise NotImplementedError
  end

  def call
    raise NotImplementedError
  end
end
class SampleService < ApplicationService
  def initialize(something)
    @something = something
  end

  def call
   # do something
  end

  private

  # remaining methods
end

I have ApplicationService just as a way to easily call a service with: SampleService.call(arguments).

1 Answers
Related