Description / Features
The plugin enables analysis of PHP projects within Sonar.
It relies on well-known external tools: PHPUnit, PHP Depend, PHPMD and PHP_CodeSniffer.
- Install the PHP Environment
- Install the Sonar PHP plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
- Restart the Sonar server
Run a Sonar Analysis with the Sonar Runner (Recommended Way)
To launch a Sonar analysis of your PHP project, use the Sonar Runner.
Run a Sonar Analysis with the other Analyzers
Disabling or enabling tool on demand
One important thing is the ability to run or disable each php tool individually.To do so, simply add the following properties to your pom.xml .
Use existing files to generate dashboard
Another interesting feature is the ability to use already generated files from pdepend, phpmd, phpunit and to get the sonar dashboard working. To do so, you have to be sure that log files for these tools are located inside $PROJECT_HOME/target/logs/. Filename must be: pdepend.xml, pmd.xml, codesniffer.xml, php-cpd.xml, phpunit.xml and phpunit-coverage.xml . If you generate you files from another tool (like ant), be sure to make a copy of these files inside target/logs directory. Also, you have to stick to the required version of tools supported from you version of Sonar PHP Plugin. Because sonar php plugin uses files located on the file system to make them match with violations, you have to be sure that your source directories and test directories are correctly referenced in your pom.xml even your project is not build with maven.
Here is an example:
Have some questions or problems?
Here's the path you should follow in this case:
- First check the plugin's FAQ or Troubleshooting sections.
- See if there is any open issues that may be linked to your question/problem
- Eventually send a mail on the user mailing list (email@example.com) to ask for help
- PHP 1.2 - short-term activity (see the JIRA open tickets)
- Improve the PHP CodeSniffer rule repository (adding missing parameters, descriptions, ...)
- Work on the "Sonar Way", PEAR and Zend profiles (<= for PHP gurus! )
- PHP 2.0 - mid-term activity
- Handle multiple files with the same name
- Consider root folders as "Projects"
- Non structured PHP files
- If it turns out that those tickets are technically difficult/long to implement, then they can be postponed
Release 1.1 (11 issues)
|SONARPLUGINS-1972||Violation tracking can't work with PHPMD violations||Closed||Fixed|
|SONARPLUGINS-1988||Fix URL for update center||Closed||Fixed|
|SONARPLUGINS-1964||Check compatibility with latests versions of PHPMD & PDepend||Closed||Fixed|
|SONARPLUGINS-1718||"sonar.*.argumentLine" properties are incorrectly passed to the external tool processes||Closed||Fixed|
|SONARPLUGINS-1711||PHP plugin not compatible with Java 7||Closed||Fixed|
|SONARPLUGINS-1675||java launcher failed load php converage||Closed||Fixed|
|SONARPLUGINS-1657||PHP source importer not importing user defined suffixes||Closed||Fixed|
|SONARPLUGINS-1650||java.io.FileNotFoundException: Too many open files||Closed||Fixed|
|SONARPLUGINS-1351||Use jdepend compatible report for storing metrics generated with PHP Depend||Closed||Fixed|
|SONARPLUGINS-1330||PHPDepend reports invalid jdepend.xml||Closed||Fixed|
|SONARPLUGINS-1643||Invalid eval expression rule name||Closed||Fixed|
Release 1.0 (14 issues)
Release 0.6 (15 issues)
Release 0.5 (23 issues)
Release 0.4 (15 issues)
Release 0.3 (23 issues)
Release 0.2 (9 issues)
|SONARPLUGINS-519||Add simple php project to SVN for testing||Closed||Fixed|
|SONARPLUGINS-517||Warning "Trying to save twice the source of"||Closed||Fixed|
|SONARPLUGINS-516||"sonar.phpPmd.shouldRun=false" doesn't work||Closed||Fixed|
|SONARPLUGINS-514||PDepend analyze fails||Closed||Fixed|
|SONARPLUGINS-513||Empty packages appear after analysis of project||Closed||Fixed|
|SONARPLUGINS-511||Duration of unit test seems to be wrong||Closed||Fixed|
|SONARPLUGINS-219||Get complexity distribution to work||Closed||Fixed|
|SONARPLUGINS-31||Scan PHP projects||Closed||Fixed|