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

Warnings Plugin MSBuildParser does not handle hyphen or underscore in category

    XMLWordPrintable

Details

    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

          johnmcase John Case created issue -
          johnmcase John Case made changes -
          Field Original Value New Value
          Description The following output (from [sass-lint|[https://github.com/sasstools/sass-lint])] is not properly handled by the MSBuild parser:

           
          {code:java}
          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`
          {code}
           

          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:

           
          {code:java}
              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*(.*)))$";
          {code}
          with the following:

           

           
          {code:java}
              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*(.*)))$";
          {code}
          I'd be happy to make a pull request in the [github repo|https://github.com/jenkinsci/warnings-plugin] but it would take me a bit to get the tooling on my workstation to write a test.

           
          The following output (from  [sass lint|https://github.com/sasstools/sass-lint]) is not properly handled by the MSBuild parser:

           
          {code:java}
          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`
          {code}
           

          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:

           
          {code:java}
              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*(.*)))$";
          {code}
          with the following:

           

           
          {code:java}
              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*(.*)))$";
          {code}
          I'd be happy to make a pull request in the [github repo|https://github.com/jenkinsci/warnings-plugin] but it would take me a bit to get the tooling on my workstation to write a test.

           
          johnmcase John Case made changes -
          Description The following output (from  [sass lint|https://github.com/sasstools/sass-lint]) is not properly handled by the MSBuild parser:

           
          {code:java}
          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`
          {code}
           

          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:

           
          {code:java}
              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*(.*)))$";
          {code}
          with the following:

           

           
          {code:java}
              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*(.*)))$";
          {code}
          I'd be happy to make a pull request in the [github repo|https://github.com/jenkinsci/warnings-plugin] but it would take me a bit to get the tooling on my workstation to write a test.

           
          The following output (from [sass lint|https://github.com/sasstools/sass-lint]) is not properly handled by the MSBuild parser:

           
          {code:java}
          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`
          {code}
           

          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:

           
          {code:java}
              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*(.*)))$";
          {code}
          with the following:

           

           
          {code:java}
              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*(.*)))$";
          {code}
          I'd be happy to make a pull request in the [github repo|https://github.com/jenkinsci/warnings-plugin] but it would take me a bit to get the tooling on my workstation to write a test.

           
          drulli Ulli Hafner made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]

          People

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

            Dates

              Created:
              Updated:
              Resolved: