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

Warnings Plugin MSBuildParser does not handle hyphen or underscore in category

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • warnings-plugin
    • None

      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.

       

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

              Created:
              Updated:
              Resolved: