An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement.
There are several reasons for a method not to have a body:
def shouldNotBeEmpty() # Noncompliant - method is empty end def notImplemented() # Noncompliant - method is empty end def emptyOnPurpose() # Noncompliant - method is empty end
def shouldNotBeEmpty() doSomething() end def notImplemented() raise NotImplementedError, 'notImplemented() cannot be performed because ...' end def emptyOnPurpose() # comment explaining why the method is empty end