I would like to create a quality profile in SonarQube that extends PSR2 rules. When I create one using this xml below, sonar shows me the following error:
Unable to import unknown PhpCodeSniffer rule 'PSR2' consider adding an extension in sonar extenions directory
<?xml version="1.0"?>
<ruleset name="test">
<description>test coding standard (extend PSR2).</description>
<!-- Include the whole PSR-2 standard -->
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength" />
</rule>
<!-- Include pear commenting standards -->
<rule ref="PEAR.Commenting.InlineComment"/>
</ruleset>
I have installed sonar 3.7.4 with PHP plugin and PHP_CodeSniffer using pear. CodeSniffer came with following standards:
$ phpcs -i
The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz and Zend
Am I missing some configuration in sonar? What should I do to be able to create the quality profile I want?
Sonar php plugin 2.2 supports PSR-2.
Also, from plugin version 2.0,
Dependency on external tools has been removed: ie PHPDepend, PHPCodeSniffer, PHPMD, PHPUnit.
These work with sonar-3.7 and above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.