Search code examples
javasonarqubecode-standardscompiler-specific

Sonarqube supports rules to enforce coding standards or not


Sonarqube produces issues with the code like bugs and security-related issues as vulnerabilities and code smell that could cause issues. Is there a way to add the coding standards to enforce conventions specific to readability and maintainability of code and more of what code reviewers perform in the code. So that automatically it can fail the quality gate if comments, variable conventions, and class and function standards are not met. But one of my Developer is saying that Sonarqube by default profile covers most of the rules and conventions that code reviewers check in the code. But I understand, rules and conventions in the coding standards document can only be reviewed by peer review and not by compilers and Sonarqube tool.

I believe developers and experts in Sonarqube and compilers can confirm whether rules and conventions in coding standards like general style for source code, standards for statements, methods, naming convention, variable assignments, standards for classes, interfaces, packages, etc. Is there is a way to add rules for coding standards via Sonarqube, kindly share?

[edited]


Solution

  • SonarQube performs various code safety and quality checks out the box. If you're looking to assert code formatting then you'll need to use a suitable plugin to extend SonarQube's quality profiles, such as the Checkstyle Plugin