I am writing a QtCreator plugin (Language Server Protocol based) that uses the Sonar Web API to show the current C++ issues in a project. I run the SonarScanner CLI to analyze the project.
Once the SonarScanner CLI runs successfully and returns “EXECUTION SUCCESS”, does the SonarQube server still need some time to process and re-index the issues in the project?
I want to know if I have to wait some time after the SonarScanner CLI has run to query the Sonar Web API for new issues in the project.
Yes, after the analysis is submitted to SonarQube it requires processing.
You can either query GET api/ce/activity_status (using other APIs in the ce domain of Web APIs), or simply make sure sonar.qualitygate.wait=true is configured for the scan, which will force the scanner to wait until the background task has finished processing and a Quality Gate status is available before the scanner exits. This will also emit a non-zero exit code if the quality gate is failed.
Thanks. I think using sonar.qualitygate.wait=true is the perfect solution. I’ll try it later. The processing page is very good. I thought I had read all the documentation, but there are some subtopics that I have missed. The documentation is very comprehensive.