Skip to end of metadata
Go to start of metadata

Not all the options available for the PHP plugin are listed here. Only the most important ones will remain documented on this page. For the other ones, you can find them on the PHP plugin settings pages, in the Web UI of Sonar (once you've installed the PHP plugin, of course).

Standard

These are some standard Sonar properties that you may want to use. Check the advanced parameters page to know more about all those properties.

Key

Example

Description

sonar.projectDate

-Dsonar.projectDate=2008-02-23

Injects historical data

sonar.exclusions

-Dsonar.exclusions=**/*locale*

Excludes sources from analysis

sonar.dynamicAnalysis

-Dsonar.dynamicAnalysis=false

Disables unit test and coverage reporting

Pdepend plugin

Deactiving pdepend is highly discouraged since all basic metrics rely on it.

Key

Possible values

Default value

Description

sonar.phpDepend.skip

true/false

false

If true, PHP Depend engine will not run and its violations will not be present in Sonar dashboard.

sonar.phpDepend.analyzeOnly

true/false

false

By default, the plugin will launch PHP Depend and parse the generated result file. If this option is set to true, the plugin will only reuse an existing report file.

sonar.phpDepend.timeout

integer

30

Maximum number of minutes that the execution of the tool should take. The process will be killed by Sonar if it lasts more than this number of minutes.

sonar.phpDepend.exclude

pattern

 

Comma separated string of packages that will be excluded during the parsing process.

sonar.phpDepend.withoutAnnotations

true/false

false

Do not parse doc comment annotations

Phpmd plugin

Key

Possible values

Default value

Description

sonar.phpPmd.skip

true/false

false

Disabling PHPMD is not a good idea because almost all metrics rely on it.

sonar.phpPmd.analyzeOnly

true/false

false

By default, the plugin will launch PHPMD and parse the generated result file. If this option is set to true, the plugin will only reuse an existing report file.

sonar.phpPmd.timeoutinteger30Maximum number of minutes that the execution of the tool should take. The process will be killed by Sonar if it lasts more than this number of minutes.

PHP CodeSniffer plugin

Key

Possible values

Default value

Description

sonar.phpCodesniffer.skip

true/false

false

If true, PhpCodeSniffer engine will not run and its violations will not be present in Sonar dashboard.

sonar.phpCodesniffer.analyzeOnly

true/false

false

By default, the plugin will launch PHP CodeSniffer and parse the generated result file. If this option is set to true, the plugin will only reuse an existing report file.

sonar.phpCodesniffer.timeout

integer

30

Maximum number of minutes that the execution of the tool should take. The process will be killed by Sonar if it lasts more than this number of minutes.

Phpcpd plugin

Valid only for PHP plugin up to version 0.6

PhpCPD has been removed in version 1.0 of the PHP plugin, and is replaced  by Sonar PMD CPD engine, for which the "sonar.cpd.php.minimumTokens" property is available.

Key

Possible values

Default value

Description

sonar.phpcpd.skip

true/false

false

If true, copy/paste measures for PHP will not be computed.

sonar.phpcpd.analyzeOnly

true/false

false

By default, the plugin will launch PHP CPD and parse the generated result file. If this option is set to true, the plugin will only reuse an existing report file.

sonar.phpcpd.min.tokens

integer

5

Minimum number of identical token used to detect copy/paste code with phpcpd.

sonar.phpcpd.min.lines

integer

3

Minimum number of identical lines used to detect copy/paste code with phpcpd.

Phpunit plugin

Key

Possible values

Default value

Description

sonar.phpUnit.skip

true/false

false

If true, PHPUnit tests will not run and unit tests counts will not be present in Sonar dashboard.

sonar.phpUnit.coverage.skiptrue/falsefalseIf true, code coverage measures will not be computed.

sonar.phpUnit.analyzeOnly

true/false

false

By default, the plugin will launch PHP Unit and parse the generated result file.If this option is set to true, the plugin will only reuse an existing report file.

sonar.phpUnit.configuration  Read configuration from XML file. Recommended way to configure the tests that should be launched.

sonar.phpUnit.mainTestClass

 

 

The project main test file including the relative path, ie : "/source/tests/AllTests.php". If not present, phpunit will look for phpunit.xml file in test directory.

sonar.phpUnit.filter

pattern

 

Ignore unit tests files matching pattern.

sonar.phpUnit.bootstrap

file

 

Use this bootsrap file to initialize unit tests

sonar.phpUnit.ignore.configuration

true/false

 

if true, phpunit will ignore any present phpunit.xml file for launching unit tests.
if not set, or false, phpunit will use any existing phpunit.xml file in the running directory.

sonar.phpUnit.analyze.test.directory

 

 

if true or if not set, sonar php will append test directory to phpunit. This will make phpunit look for test cases inside this directory. If several directories are defined as test directories, a phpunitRANDOM.xml file will be generated and passed to phpunit --configuration=. This generated file will contain all files inside the test directories.

Labels
  • None