Increase Coverage by Unit Tests
Unit Tests are widely regarded as one of the best ways to ensure higher quality code across the development and maintenance cycle. SonarSource products come with built-in capabilities to execute third-party unit testing tools like PHPUnit, Cobertura, JaCoCo, NCover and others, enabling automation of code coverage reporting.
Avoid Duplicated Code
SonarSource products come with advanced copy & paste detection mechanisms that not only find copies inside a project but also perform cross-project duplication analysis. By highlighting duplicated code, the SonarQube platform enables developers to take immediate remedial action, therefore decreasing the number of lines to be maintained and easing the maintenance process by not having to perform it twice.
Keep Code Complexity Low
McCabe cyclomatic complexity has been considered a key metric to monitor and measure maintainability of software since the 1970s. Keeping the complexity low in a method ensures that the method is easy to read, therefore easy to understand and therefore easy to maintain. The golden rule is that no class or method is too small. SonarSource products enable reporting on high complexity and help to reduce it.
Maintain a High Quality Architecture
Architecture and design are typically of high quality when an application is initially created, but slowly erode over time. This erosion will make modification and maintenance more difficult. SonarSource products help in diagnosing this erosion and in providing concrete actions to correct it.
Enforce Coding Standards
SonarSource products help to enforce and improve two categories of coding standards:
- Style issues: Although these are not critical in terms of risk, they have a clear impact on the readability of the source code and therefore affect productivity.
- Best practices: This covers coding elements such as exceptions management or logging, which have a great impact in terms of operating and maintaining applications.
It is sometimes difficult for human beings to understand all possible paths in a program or all combinations of parameters that can lead to bugs. SonarSource products provide investigation capabilities for these type of issues to eradicate them and avoid the risk of failure in production environments.
Documentation is key to understanding how software works from the inside, and this is especially true when discussing APIs. SonarSource products provide the unique capability to report on undocumented public APIs, increasing the productivity of developers.