Full documentation for SonarQube has moved to a new location: http://docs.sonarqube.org/display/SONAR

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 48 Next »

Features

Sonar PHP Plugin provides PHP language support to Sonar. The plugin enables all Sonar builtin features for PHP projects. It relies on well known analysis tools for PHP: PHP Unit, PHP Depend, PHPMD, PHPCPD and PHP_CodeSniffer to provide some additionnal metrics and to detect violations.

Sonar PHP Plugin

PHPUnit

phpcpd

PHP Depend

PHPMD

PHP_CodeSniffer

SQLI CodeSniffer

0.2

3.4.12

(error)

0.9.12

0.2.5

(error)

0.4.0

0.3

3.5.5

1.3.1

0.9.14

0.2.5

1.3.0RC1

(error)

0.4

3.5.5

1.3.1

0.9.14

0.2.5

1.3.0RC1

(error)

0.5

3.5.5

1.3.1

0.10.6

1.1.0

1.3.0RC1

(error)

Note that Sonar PHP Plugin 0.2 used to rely on SQLI_CodeSniffer which was an ad hoc spin-off of PHP_CodeSniffer.
Sonar PHP Plugin 0.3 and next versions rely directly on PHP_CodeSniffer.

Installation

This installation section provides two ways for installing necessary tools to make the plugin work correctly. If you are familiar with the PHP environnement, you may just need to reed the "Short way" section, if you need more help, you can follow the more verbose installation guide.

Install Sonar PHP Plugin

Sonar PHP Plugin is very straightforward: Once you have installed sonar in $SONAR_HOME directoy, just copy the sonar-php-plugin.jar file inside $SONAR_HOME/extensions/plugins/ directory.

Install PHP environnement

Short way for PHP experts
  1. Install PHP runtime with the corresponding xdebug extensions. Version 5.2.6 or newer is required.
  2. Install PEAR. Version 1.8.0 or newer is required
  3. Install PHPUnit version 3.5.5 (strictly)
  4. Install phpcpd version 1.3.0 (strictly)
  5. Install PHPDepend PHPMD version 0.2.5
  6. Install PHP_CodeSniffer version 1.3.0
Long way for PHP dummies
  1. Install PHP version 5.2.6 or newer. You can download PHP at this location and follow these installation instructions.
  2. Install PEAR version 1.8.0 or newer if not included in PHP distribution. To ensure pear version and to upgrade it type the following commands in command prompt:
    If you, for some reason, need the latest PEAR and the commands above don't get it then download http://pear.php.net/go-pear.phar and execute it with php (don't use the old go-pear without the .phar extension, it will likely fail):
  3. Install PHPUnit from pear using the following command lines:
  4. Install XDebug to allow code instrumentation used for instance by phpunit to compute coverage.
    • If you are running Linux or Mac you must install phpize (normally found in php dev packages like rpm php5-devel, deb php5-dev) and then compile xdebug via pecl install using the following command line
      And then edit your $PHP_HOME/cli_php.ini file to add the following line:
    • If you are running windows, you should download the binary version matching your PHP installation from this location. And then edit your $PHP_HOME/cli_php.ini file to add the following line:
  5. Install PHP Depend
  6. Install PHPMD
  7. Install PHP_CodeSniffer
  8. Install phpcpd

You are now ready to configure your projet for first analysis. Refer to the page How Sonar PHP Plugin works to see how you can configure your project with maven.
Since Sonar 2.6 you can also use ant to generate your dashboard, more informations on this page and onthe sonar ant task page.

Known limitations

See open issues

Roadmap

  1. PHP 0.6 - very-short-term activity.
    1. Better handling of file with same name in different directories
    2. Better support of Ant
    3. Validate support of the Simple Runner
    4. Create a real "Sonar PHP Way" profile and clean up rules
    5. Inner improvements (improve PHPUnit & PHPDepend execution)
  2. PHP 0.7 - short-term activity
  3. PHP 1.0 - mid-term activity
    1. Tricky-but-important tickets
    2. If it turns out that those tickets are technically difficult/long to implement, then version 1.0 could be released earlier and those tickets bumped into a 1.x version

Changelog

com.atlassian.confluence.macro.MacroExecutionException: JIRA project does not exist or you do not have permission to view it. com.atlassian.confluence.macro.MacroExecutionException: JIRA project does not exist or you do not have permission to view it. com.atlassian.confluence.macro.MacroExecutionException: JIRA project does not exist or you do not have permission to view it.com.atlassian.confluence.macro.MacroExecutionException: JIRA project does not exist or you do not have permission to view it.
  • No labels