Sonar limitations

Hi,

Sonar, generally scans for 1 language and rules and the gate is set for that language. Having multiple language rule and gate is limitation of Sonar. Please suggest a solution for this.

Thanks & Regards,
Gokila Balakrishnan.

Hi @GokilaBalakrishnan,

I saw your other thread on using SonarQube 7.7. That version should handle “multi” language support automatically. Does it not work like that?

In any case, 7.7 is very old and you should try the latest version 8.6. Download here.

Joe

Thanks for your feedback. Please confirm how to configure the quality gates in jenkins while doing multi language scanning.

Gokila

Hi Gokila,

SIngle or multilanguage for a project is independent of a quality gate, i.e. quality gates are not dependent on number of languages. You can configure the quality gate in Jenkins using the Web API (documentation link in footer of any page in SonarQube or click on the :question: icon next to the search field in the top right-hand corner and click on “Web API”):

POST api/qualitygates/select

This web API endpoint is not specific to Jenkins so you can create a Script task/step in your pipeline to execute a curl command hitting that endpoint (with the appropriate query parameters) to adjust the quality gate as needed.

EDIT: On 2nd thought, the SonarQube recommended way is to provision and configure projects ahead of time before running Sonar scanner analysis. See Project Existence for more info. The idea is to set up your projects including quality gate, quality profile, etc. without setting it from within the build. You should configure the project before running your first analysis. Please try this method before using the web API method I mentioned above.

Joe