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 you really want to exclude files from being analyzed by an external tool (may it be PHP CodeSniffer, PHPMD or PHP Depend):
- a file is badly written and the tool is crashing when analyzing this file, thus preventing Sonar from completing the analysis
- a big number of files must be excluded and there's no need for the external tools to spend time analyzing files that won't be reported in Sonar
For these specific cases, you should use the
sonar.xxxx.argumentLine property of the external tool to manually define exclusions. For instance, for PHP CodeSniffer, you would add the following property:
sonar.phpCodesniffer.argumentLine=--ignore=Database/* # on Linux, would be --ignore=Database\* on Windows
This would tell PHP CodeSniffer to ignore every PHP file located in the Database folder.
When specifying exclusions directly for each tool, you should also consider to set the
hen 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.