This plugin can be used to import PHPCS reports into SonarQube.
The plugin will not run PHPCS but instead re-use the report generated by it. Here are the steps:
- Download and install PHPCS on the machine or project running the SonarQube analysis
- Get sonar-phpcs-plugin jar file:
- Install this SonarQube PHPCS plugin (see instructions to manually install a SonarQube plugin)
- Run PHPCS to create a json report e.g.:
phpcs --standard=PSR12 --report-json=output/phpcs.json src- Set the
sonar.php.phpcs.reportPathsanalysis property to the path of the PHPCS json report, e.g.:
sonar.php.phpcs.reportPaths=output/analysis/phpcs.json
- Run the SonarQube analysis on your project