Why this matters
Empty methods can be misleading, making it unclear whether they are unfinished, redundant, or intentionally blank. If an empty method is necessary, include a comment explaining why.
Detect methods that have an empty body. If a method is empty, ensure that a comment is present explaining why it remains unimplemented.
Empty methods can be misleading, making it unclear whether they are unfinished, redundant, or intentionally blank. If an empty method is necessary, include a comment explaining why.
Side-by-side examples engineers can pattern-match during review.
def shouldNotBeEmpty() # Noncompliant - method is empty
end
def notImplemented() # Noncompliant - method is empty
end
def emptyOnPurpose() # Noncompliant - method is empty
enddef shouldNotBeEmpty()
doSomething()
end
def notImplemented()
raise NotImplementedError, 'notImplemented() cannot be performed because ...'
end
def emptyOnPurpose()
# comment explaining why the method is empty
enddef shouldNotBeEmpty() # Noncompliant - method is empty
end
def notImplemented() # Noncompliant - method is empty
end
def emptyOnPurpose() # Noncompliant - method is empty
enddef shouldNotBeEmpty()
doSomething()
end
def notImplemented()
raise NotImplementedError, 'notImplemented() cannot be performed because ...'
end
def emptyOnPurpose()
# comment explaining why the method is empty
endFrom the same buckets as this rule.
Before persisting ePHI, encrypt using a data key protected by a Key Management Service (KMS). Use authenticated encryption (AES-256-GCM or equivalent), rotate keys, and store the key id and algorithm with the record.