How does sonar work: sonar?

We want to use SonarQube with some CI tool in our project. The Sonar Server URL is configured in the main pom.xml file.

There are several team members in the project. So, what happens when one of the team members performs sonar: sonar locally with its local changes, then another member of the team performs sonar: sonar with its local changes, and then someone performs sonar: sonar from the CI tool (it is configured for analysis source code in git repository)?

Will SonarQube display issues related to local team member changes? What if there are differences between the local source code of the team members and the source code in the Git repository?

+7
java maven sonarqube bamboo sonarqube-scan
source share
2 answers

sonar:sonar performs the analysis and sends the results to the server - if you use it with an account token that has the appropriate privileges.

Developers do not have to run this type of analysis locally to verify their changes. Instead, they should use SonarLint and, possibly, analysis of the choice request (depending on your infrastructure).

Expand a little about why developers should not use sonar:sonar locally: it updates the central server using the last saved win method. Therefore, if you edited A.java and analyzed it locally before committing, and I renamed A.java to B.java and did a similar local pre-commit analysis ... what is visible on the SonarQube server? Depends on who saved / analyzed the latter.

Instead, sonar:sonar should only be run from your CI tool with a registration code that is already displayed to the entire team.

+13
source share

As you said, the sonar server URL is configured in pom.xml mail, and your team member launches the sonar: sonar command on the local computer. But due to the fact that everyone refers to the same server URL. Thus, all changes will reflect the overall project. If you want to see the difference separately for each team member. either you need to update the project name different from another. Otherwise, you will see the latter.

Sonar gives you the difference graphically. and also you can compare two assemblies too.

Second. If the user has only an administrator, he can not upgrade the sonar server yet.

+2
source share

All Articles