Search code examples
sonarqubecode-analysis

SonarQube - how to run the code analysis again for a project after creating that project


I have created a project and run the code analysis. Later I did some changes in rules and tried to run the code analysis again. But in the UI of http://localhost:9000/projects, I can't find any menu or button to show the instructions of running code analysis. Can anyone help?


Update on 25/02/2020

For example, I am using SonarQube for a .NET (C#) project. When I do the code analysis, as SonarQube suggested, I copied the 3 command below into command line.

SonarScanner.MSBuild.exe begin /k:"" /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=""

MsBuild.exe /t:Rebuild

SonarScanner.MSBuild.exe end /d:sonar.login=""

If SonarQube can show these commands in UI of http://localhost:9000/dashboard?id=, that will be great. Otherwise, it’s hard to remember these command and the only way to run the code analysis again is to create a new project in SonarQube UI. For now, I copied these 3 commands into a .bat file after creating a project. And every time run this .bat file again after some changes in project configuration.


Solution

  • There are two important components in the ecosystem:

    • SonarQube:

      • serves plugins and project configurations
      • consumes and displays analysis results
    • SonarScanner

      • consumes plugins and project configurations
      • performs analysis and publish the results

    When you change anything in the project configuration, you have to perform a new analysis to see the results. It means you have to:

    run the code analysis