Two functions having the same implementation are suspicious. It might be that something else was intended. Or the duplication is intentional, which
becomes a maintenance burden.
func calculate() {
doTheThing()
doOtherThing()
}
func doEverything() { // Noncompliant: duplicates calculate
doTheThing()
doOtherThing()
}
If the identical logic is intentional, the code should be refactored to avoid duplication. For example, by having both functions call the same
function or by having one implementation invoke the other.
func calculate() {
doTheThing()
doOtherThing()
}
func doEveryting() { // Intent is clear
calculate()
}
Exceptions
Methods with fewer than 2 statements are ignored.