Empty functions and methods should be avoided

Why you should care

For maintainability aspect, it is not recommended to have empty functions, methods or classes, as it could decrease readability because readers need to guess whether it’s intentional or not.

Technology scope: ABAP, C#, Go, Groovy, Java, Kotlin, Scala, Swift.

Note that for Java and Kotlin, this code insight also applies for classes.

5362

CAST Recommendations

Check if the object is referenced. If not then remove it.

How we detect

This Code Insight counts one occurrence each time a function, a method or a class is found and that it doesn’t contain any statement.
5362

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.