shekhar verma
shekhar verma

Reputation: 499

Sonar False-Positive Feature

I am using sonar false-positive feature in my project deployed on sonar server and i have marked some violation instances(lets 50 instances) as false positive.

Now i create a new project in sonar having the same code base and deploy it on sonar. As code base is same for both of my projects this is obvious that those "50" violation instances will occurs here also, which i have marked as false-positive in my previous project. Now i dont want to spend time to mark these instances as false-positive again so i want to ask is there any way to mark these "5o" violation instances as false-positive by refering my first project without doing manually??

Can i make a template/profile type feature to copy false-positive marks from one project and apply it on other project having same code base so that i can save my time??

Kindly revert if anyone know any way to execute this. Your response will be appreciable.. Thankks in advance!

Upvotes: 2

Views: 3246

Answers (2)

Sylvain Chabert
Sylvain Chabert

Reputation: 11

The only trick I found was to add a // NOSONAR comment on line containing the false positive. This way, the information is shared among branches.

But, as the NOSONAR masks any sonar issue, you may miss another sonar issue as the one intended to mask.

Example:

 var myVar; // NOSONAR

Upvotes: 1

It is not currently possible to achieve what you want, unless you write a small Java program that uses Sonar Web Service Java client and that does the job.

Upvotes: 1

Related Questions