Top SonarQube frequently asked interview questions.
What is SonarQube
A:Sonar is a web based code quality analysis tool for Maven based Java projects. It covers a wide area of code quality check points which include: Architecture & Design, Complexity, Duplications, Coding Rules, Potential Bugs, Unit Test etc.
Q: Why use SonarQube ?
A:Sonar covers the 7 sections of code quality
- Architecture and Design
- Unit tests
- Duplicated code
- Potential bugs
- Complex code
- Coding standards
- SonarQube is open source
- SonarQube supports for various languages like Java, C#
- SonarQube reports for duplicate code, unit testing, code coverage, code complexity historical
- We can integrate SonarQube with build tools like ant, gradle
- SonarQube has Eclipse plugin like Sonarlint
- SonarQube supports external plugins like plugin for ldap
Q: What are Quality Profiles in SonarQube?
A: The Quality Profiles service is central to SonarQube, since it is where you define your requirements by defining sets of rules (ex: Methods should not have a Cognitive Complexity greater than 15).
Ideally, all projects will be measured with the same profile for any given language, but that's not always practical. For instance, you may find that:
The technological implementation differs from one application to another (for example, different coding rules may apply when building threaded or non-threaded Java applications). You want to ensure stronger requirements on some of your applications (internal frameworks for example).