Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube: Php equivalent annotation for ignoring sonarqube rule

Tags:

sonarqube

I know that in Java, we can ignore the a Sonarqube rule for specific method with annotations. For example...

@SuppressWarnings("squid:S2078") 

With php, I have not narrowed down how to do this yet. Is there an equivalent example that ignores one rule for a specific piece of code (not necessarily for a class/function, but it would be a start :) )

like image 269
R F Avatar asked Sep 15 '25 19:09

R F


1 Answers

The current version of php analyser (SonarPhp 2.14 in SonarQube 7.3) does not have a feature (annotation based or not) for ignoring a specific rule.

The php analyser only support one issue filtering, the NoSonarFilter that disable all rules at a specific line by using a comment containing NOSONAR.

If a rule generate some false positives, or if you are facing a real life example where such filter is require, you can provide some feedback at community.sonarsource.com

like image 139
Alban A. - SonarSource Team Avatar answered Sep 18 '25 10:09

Alban A. - SonarSource Team