I have projects that do not use the required versions of PHPUnit, PHP Depend, etc. What can I do?
If you are able to have several versions of code analysis tool on the same machine, just make sure that the correct one will be used.
You also have to make sure that the output file log is compatible with the one specified by the version of the tool you want to use.
How do I prevent external tools from analyzing some source files?
Most of the time, using the sonar.exclusions property will be enough to exclude files from being reported by Sonar. However, there might be some cases where one really wants to exclude files from being analyzed by an external tool (may it be PHP_CodeSniffer, PHPMD or PHP Depend):
In these specific cases, you should use the 'sonar.xxxx.argumentLine' property of the external tools to manually add the exclusions you want. For instance, for PHP_CodeSniffer, you would add the following property:
sonar.phpCodesniffer.argumentLine=--ignore=Database/* # on Linux, would be --ignore=Database\* on Windows
When specifying exclusions directly for each tool, you should also consider to set the 'sonar.exclusions' property accordingly. Otherwise, you may have files with incomplete analysis.
How do I disable unit test & coverage reporting?
The easiest way to disable unit test reporting is to use the following standard Sonar property:
If you want to disable only unit test reporting or coverage reporting, you can use the following properties instead:
When analyzing a large PHP project, PHP hangs or ends with a unusual return code
PHP executable may have reached its maximum allocated memory. Increase the memory_limit value in your php.ini file. For example the file is located in /etc/php5/cli/php.ini on Ubuntu.
; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 512M
When analyzing large PHP project, Maven hangs with a Java heap space message
Increase the maximum heap memory allocated for Maven by setting the environment variable MAVEN_OPTS.
When analyzing a large PHP project, PHP Depend hangs with an error code 255 and message saying "Maximum function nesting level of ‘100′ reached"
Increase the maximum number of nested levels by editing your php.ini files and setting a value greater than 100 (which is default). You may also need to increase the maximum amount of memory that a script can consume.
; Maximum input variable nesting level ; http://php.net/max-input-nesting-level max_input_nesting_level = 200 xdebug.max_nesting_level = 200 ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 1024M