Why property "sonar.profile" marked as deprecated? - sonarqube

I am looking for a Sonar Property to attach the quality profile during the build. In previous versions of Sonar there was a property -Dsonar.profile which is deprecated now. Can anyone please help me to get the property to attach the quality profile at runtime.
I am using Sonar version 4.5.7. Any help is highly appreciated.
Thanks,
Sanjiv

It has been marked as deprecated with no replacement.
Quoting page http://docs.sonarqube.org/display/SONARQUBE43/Analysis+Parameters :
Note that only parameters set through the UI are stored in the
database. For example, if you override the sonar.profile parameter via
command line for a specific project, it will not be stored in the
database. Local analyses in Eclipse, for example, would still be run
against the default quality profile.
And the latest version of the same page http://docs.sonarqube.org/display/SONAR/Analysis+Parameters has link to ticket about deprecation that contains other details - https://jira.sonarsource.com/browse/SONAR-5370
In other words - profile should be configured via UI or using web services.

Related

How to prevent SonarQube not check specific vulnerability

I have some code that want to SonarQube not check this vulnerability while every deployment.
Any method for add rule for not check X type vulnerability with some error text ?
I found an answer and want to inform for who need answer
https://sqa.stackexchange.com/questions/24734/how-to-deactivate-a-rule-in-sonarqube
Need to copy existing SonarQube built-in profile and deactivate/add new rule in new profile,
after that go to project settings and change Quality Profile.

How can I get the open new issues, confirmed new issues, false positive new issues?

This is a screen where we configure our project, SonarQube shows new issues open, confirmed which is highlighted in yellow, I am using the SonarQube API in my application and want to dump the data to my DB. Accordingly I will create the report. But In Sonar Metrics document I do not find how could I get these value using API.
api/issues/search should get you all you need. Check out the documentation embedded in your SonarQube server (linked at the footer).
From the use-case you describe, parameters sinceLeakPeriod or createdAfter / createdInLast can help out with date filtering. Not to mention other filters like resolved and componentKeys. Exchaustive listing is in the WebAPI documentation.

SonarQube Web Api Changes from 6.0 to 6.4

I was using "http://sonarserver:9000/api/resources?metrics=ncloc,bugs,vulnerabilities" to get the details of all the projects for sonar 6.0.
After upgrading to 6.4 this url does not work and I am not able to find the alternative for this under the web_api changes page.
Please let me know if anyone knows about an alternative to this.
Error: {"errors":[{"msg":"Unknown url : /api/resources"}]}
Per WebAPI documentation (embedded in your own SonarQube server, linked at the footer): api/resources/index is deprecated since 5.4 (i.e. a super long time ago).
The documentation even provides some guidance:
if you need one component with measures: api/measures/component
That will get you the measures you need for a given project. You can use other APIs to get the list of projects (e.g. api/components/search). See Web API docs for the full listing of possibilities.

Can anyone help me in exporting Sonarqube rules which are Inactive using Web API?

I'm currently using SonarQube v5.6 and I'm trying to export the list of the rules that are inactive.
We can take "BackUp" of the rules that are active through the UI, but I'm trying to do this using Web API supported by Sonarqube on command line.
For Example:
I'm trying to export the rules which are not active in sonarqube:
http://$sonarqubeServer/coding_rules#qprofile=$key|activation=false
Can anyone please help me how to go about this ?
SonarQube Web API is pretty well documented (accessible from the footer of your server). api/rules offers api/rules/search which takes a bunch of parameters, including:
activation - Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not
set.
qprofile - Key of Quality profile to filter on. Used only if the parameter 'activation' is set.
Bottom line, this request in the UI:
https://sonarqube.com/coding_rules#activation=false|qprofile=js-sonar-way-56838
Is equivalent to this Web API request:
https://sonarqube.com/api/rules/search?activation=no&qprofile=js-sonar-way-56838

Issue assign plugin in sonarqube

When configuring issue assign plugin in sonarqube I found examples using the word key.
example - Key: sonar.issueassign.default.assignee
Can you please explain to me how to use this feature and how to use this key to fill the configuration.
The plugin will assign issue to this user, when can not determine who is the author of change. You should fill it with SonarQube user name.
Example:
sonar.issueassign.default.assignee=agabrys

Resources