Skip to content

missing-super

Rubysuspiciousno fixdefault: offruby/rubocop

Reports initialize of a class with a parent other than Object, and the callbacks inherited and method_added, that do not call super.

The parent’s initialize sets up the object, so a subclass that does not call it leaves the parent’s state unset. The inherited and method_added hooks of a base class do work that a subclass must not skip.

To fix, call super.

Reported
...
end
class D < B
def initialize
end
end
...
ruby:
lint:
rules:
missing-super: warn # off (default), warn, error

Enabled by the presets: ruby/rubocop.

Suppress one line with sudsy-disable-next-line missing-super in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
rubocop Lint/MissingSuper full