Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51485

Warnings Plugin MSBuildParser does not handle hyphen or underscore in category

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The following output (from sass lint) is not properly handled by the MSBuild parser:

       

      dist/search-list.component.scss(41,17): warning shorthand-values : Property `margin` should be written more concisely as `5px 0 0` instead of `5px 0 0 0`
      

       

      After fiddling around with it, I was able to figure out that it is failing on the category value "shorthand-values"

      Currently, the regex only expects letters and numbers in that string, it does not match on hyphens.

      I think the regex should be expanded to handle hyphens (and underscores would be good too.)

      The change should be simple enough.  Just modify the regex:

       

          private static final String MS_BUILD_WARNING_PATTERN = "(?:^(?:.*)Command line warning ([A-Za-z0-9]+):\\s*(.*)\\s*\\[(.*)\\])|"
                  + ANT_TASK + "(?:(?:\\s*\\d+>)?(?:(?:(?:(.*)\\((\\d*)(?:,(\\d+))?.*\\)|.*LINK)\\s*:|(.*):)\\s*([A-z-_]*\\s?(?:[Nn]ote|[Ii]nfo|[Ww]arning|(?:fatal\\s*)?[Ee]rror))\\s*:?\\s*([A-Za-z0-9]+)\\s*:\\s(?:\\s*([A-Za-z0-9.]+)\\s*:)?\\s*(.*?)(?: \\[([^\\]]*)[/\\\\][^\\]\\\\]+\\])?"
                  + "|(.*)\\s*:.*error\\s*(LNK[0-9]+):\\s*(.*)))$";
      

      with the following:

       

       

          private static final String MS_BUILD_WARNING_PATTERN = "(?:^(?:.*)Command line warning ([A-Za-z0-9]+):\\s*(.*)\\s*\\[(.*)\\])|"
                  + ANT_TASK + "(?:(?:\\s*\\d+>)?(?:(?:(?:(.*)\\((\\d*)(?:,(\\d+))?.*\\)|.*LINK)\\s*:|(.*):)\\s*([A-z-_]*\\s?(?:[Nn]ote|[Ii]nfo|[Ww]arning|(?:fatal\\s*)?[Ee]rror))\\s*:?\\s*([A-Za-z0-9\\-_]+)\\s*:\\s(?:\\s*([A-Za-z0-9.]+)\\s*:)?\\s*(.*?)(?: \\[([^\\]]*)[/\\\\][^\\]\\\\]+\\])?"
                  + "|(.*)\\s*:.*error\\s*(LNK[0-9]+):\\s*(.*)))$";
      

      I'd be happy to make a pull request in the github repo but it would take me a bit to get the tooling on my workstation to write a test.

       

        Attachments

          Activity

          Hide
          johnmcase John Case added a comment -

          Getting the tooling to create a pull request wasn't that difficult after all...

          PR Created:  https://github.com/jenkinsci/warnings-plugin/pull/128

           

          Show
          johnmcase John Case added a comment - Getting the tooling to create a pull request wasn't that difficult after all... PR Created:  https://github.com/jenkinsci/warnings-plugin/pull/128  
          Hide
          johnmcase John Case added a comment -

          Ulli Hafner This was auto assigned to you.  If you aren't the right person to do this can you please pass it off to somebody else?

          Show
          johnmcase John Case added a comment - Ulli Hafner This was auto assigned to you.  If you aren't the right person to do this can you please pass it off to somebody else?
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/edu/hm/hafner/analysis/parser/MsBuildParser.java
          src/test/java/edu/hm/hafner/analysis/parser/MsBuildParserTest.java
          src/test/resources/edu/hm/hafner/analysis/parser/issue51485.txt
          http://jenkins-ci.org/commit/analysis-model/d1ca0112f56d42cfc7d352febbc491f944a8cec3
          Log:
          [FIXED JENKINS-51485] Support '-' and '_' in category names.

          See https://github.com/jenkinsci/warnings-plugin/pull/128

          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/edu/hm/hafner/analysis/parser/MsBuildParser.java src/test/java/edu/hm/hafner/analysis/parser/MsBuildParserTest.java src/test/resources/edu/hm/hafner/analysis/parser/issue51485.txt http://jenkins-ci.org/commit/analysis-model/d1ca0112f56d42cfc7d352febbc491f944a8cec3 Log: [FIXED JENKINS-51485] Support '-' and '_' in category names. See https://github.com/jenkinsci/warnings-plugin/pull/128 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: John Case
          Path:
          src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
          src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java
          src/test/resources/hudson/plugins/warnings/parser/issue51485.txt
          http://jenkins-ci.org/commit/warnings-plugin/729eddae4d762cfe38926df8f3965416d21b4741
          Log:
          Support '-' and '_' in category with MSBuildParser

          Resolves https://issues.jenkins-ci.org/browse/JENKINS-51485

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: John Case Path: src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java src/test/resources/hudson/plugins/warnings/parser/issue51485.txt http://jenkins-ci.org/commit/warnings-plugin/729eddae4d762cfe38926df8f3965416d21b4741 Log: Support '-' and '_' in category with MSBuildParser Resolves https://issues.jenkins-ci.org/browse/JENKINS-51485
          Hide
          johnmcase John Case added a comment -

          Ulli Hafner Thank you for merging the PR!

          What is the typical release process?  When will I be able to update the warnings-plugin with this fix on my Jenkins server?

          Show
          johnmcase John Case added a comment - Ulli Hafner Thank you for merging the PR! What is the typical release process?  When will I be able to update the warnings-plugin with this fix on my Jenkins server?
          Hide
          drulli Ulli Hafner added a comment -

          The release is on its way and should be available in the update center in a couple of hours.

          Show
          drulli Ulli Hafner added a comment - The release is on its way and should be available in the update center in a couple of hours.

            People

            Assignee:
            drulli Ulli Hafner
            Reporter:
            johnmcase John Case
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: