Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.6
-
Fix Version/s: 1.0
-
Component/s: None
-
Labels:
-
Environment:Linux x86-32
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()); }
Attachments
Issue Links
- is related to
-
SONARPHP-236 Handle PHP source code exclusions in a single place, whatever the tool is
-
- Closed
-