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 3 Next »

Authors

Jérôme Tama, Akram Ben Aissi, Frédéric Leroy, Gabriele Santini

Jira

http://jira.codehaus.org/browse/SONARPLUGINS/component/13723

Latest Version

0.2 ( check version compatibility )

License

LGPL v3

Sources

http://svn.codehaus.org/sonar-plugins/trunk/php/

Download

Sonar PHP Plugin

Features

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

Sonar PHP Plugin

PHP Unit

PHP Depend

PHPMD

PHP_CodeSniffer

SQLI CodeSniffer

0.2

3.4.12

0.9.12

0.2.5

(error)

0.4.0

0.3

3.5.5

0.9.14

0.2.5

1.3.0RC1

(error)

 

 

 

 

 

 

Version 0.2 relies on SQLI_CodeSniffer which is derived from PHP_CodeSniffer but incompatible with the original tool.

Installation

  1. Install PHP
    1. PHP at least 5.2.6 is required for this procedure and the plugins to work smoothly
  2. Install PEAR if not included in PHP distribution
    1. Make sure your PEAR version is strictly bigger than 1.8.0
    2. (tutorial for MacOS X Leopard)
  3. Install PHP Unit
  4. Install XDebug
    1. On Linux/Mac
      1. you must have phpize installed, normally found in php dev packages like rpm php5-devel, deb php5-dev, ...
      2. compile xdebug via a pecl install
      3. This will create an extension xdebug.so
    2. Windows users must instead use the binaries. Find the right one here
    3. You must add this line to your cli php.ini
  5. Install PHP Depend
  6. Install PHPMD
  7. Install SQLI_CodeSniffer
    1. Follow the instructions here
  8. Copy the sonar plugins (.jar file) to /extensions/plugins/ directory
  9. Restart Sonar Web server

Known limitations

This is an alpha version so we expect it to have a lot of bugs/uncovered cases. Please report all bugs you find on Jira.

Metrics in this version are only collected by PHP_Depend, this implies that files containing unstructured code (not OO) will not be included in this kind of analysis.
It is known that copy/paste detection is wrongly extended to comments (see #218).
The actual CodeSniffer standard used by default is just a demo one.
You can include other standards with their configuration files the "SQLI_CodeSniffer way".
We suggest you to wait for the 1.3.0 release of PHP_CodeSniffer that will bring extended configuration capabilities and will be rapidly integrated with the plugins.

Changelog

Loading

Release 0.2 (${entries.size()} issues)

Type Key Summary Priority Status Resolution

  • No labels