Details
Description
Hello,
When I try to ignore some files/directories using the "sonar.phpCodesniffer.ignoreArgument" argument, it does not work. I looked at the code and it seems I need to have ignore patterns at the project level, and this argument set with anything to make it work.
Worst, if you use "sonar.phpCodesniffer.argumentLine", the --ignore switch is appended to the command. I'm actually using this argument to ignore files, which is not really intended for.
I've a quick patch for the first issue, to use the argument value if it's set:
Index: sonar-php-plugin/src/main/java/org/sonar/plugins/php/codesniffer/PhpCodeSnifferConfiguration.java
===================================================================
--- sonar-php-plugin/src/main/java/org/sonar/plugins/php/codesniffer/PhpCodeSnifferConfiguration.java (revision 4878)
+++ sonar-php-plugin/src/main/java/org/sonar/plugins/php/codesniffer/PhpCodeSnifferConfiguration.java (working copy)
@@ -201,10 +201,16 @@
/**
* Gets the ignore list argument value.
- *
+ *
* @return the ignore list
*/
public List<String> getExclusionPatterns() {
+ String[] values = getProject().getConfiguration().getStringArray(PHPCS_IGNORE_ARGUMENT_KEY);
+
+ if (null != values && values.length > 0) {
+ return Arrays.asList(values);
+ }
+
return Arrays.asList(getProject().getExclusionPatterns());
}
Issue Links
- is related to
-
SONARPLUGINS-682
Handle PHP source code exclusions in a single place, whatever the tool is
-
"sonar.phpCodesniffer.ignoreArgument" has been removed. If someone wants to really specify it, this should be done through the "sonar.phpCodesniffer.argumentLine" property.