Understanding the static code analysis
Static code analysis is the process of analyzing code without executing it. Code review is also a sort of static code analysis but is performed with humans or team members. Generally, static code analysis is performed by an automated tool.
Usually, a static analysis includes the following metrics:
- Violation of coding best practices such as long method body, long parameter list, large classes, and variable names.
- Cohesion represents responsibility of a single module (class). If a module or class possesses too many responsibilities, such as tax calculation, sending e-mails, and formatting user inputs, the class or module is less cohesive. Performing multiple dissimilar tasks introduces complexity and maintainability issues. High cohesion means performing only a particular type of task.
Suppose a person is assigned to handle customer tickets, code new features, design the architecture, organize the annual office party, and so on; this person will be over...