Unable to add codesniffer, psr-1, psr-2, pmd rules in sonarqube

525 views Asked by At

Need to add codesniffer, psr-1, psr-2, pmd rules in sonarqube. I tried finding plugin but get sonar-php-codesniffer0.2 plugin which is compatible only upto sonarqube>2.0. Also there is no way to import custom php rules in sonarqube6.1 or updated versions. How can now i add these rules to sonarqube for code quality analysis?

1

There are 1 answers

0
Elena Vilchik On

You can create a new plugin which imports issues from other tools (like CodeSniffer) into SonarQube.

See for example https://github.com/SonarQubeCommunity/sonar-cppcheck or https://github.com/Designite/sonar-designite-plugin.

Moreover you can create your own custom rules (docs) for SonarPHP.

Note that SonarPHP already has some coverage for psr-1 and psr-2 (rules list).