Uploaded image for project: 'SonarPHP'
  1. SonarPHP
  2. SONARPHP-76

Argument sonar.phpCodesniffer.ignoreArgument not taken in account

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 1.0
    • Component/s: None
    • 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

            Activity

              People

              Assignee:
              fabemn OLD - Fabrice Bellingard
              Reporter:
              Anonymous Anonymous
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: