Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Support '-' and '_' in category with MSBuildParser
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcase committed May 22, 2018
1 parent febf22e commit 729edda
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Expand Up @@ -19,7 +19,7 @@ public class MsBuildParser extends RegexpLineParser {
private static final long serialVersionUID = -2141974437420906595L;
static final String WARNING_TYPE = "MSBuild";
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*(.*?)(?: \\[([^\\]]*)[/\\\\][^\\]\\\\]+\\])?"
+ 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*(.*)))$";

/**
Expand Down
Expand Up @@ -17,6 +17,29 @@
* Tests the class {@link MsBuildParser}.
*/
public class MsBuildParserTest extends ParserTester {
/**
* Parses a file with warnings of Stylecop.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-8347">Issue 8347</a>
*/
@Test
public void issue51485() throws IOException {
Collection<FileAnnotation> warnings = new MsBuildParser().parse(openFile("issue51485.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 2, warnings.size());

Iterator<FileAnnotation> iterator = warnings.iterator();
FileAnnotation annotation = iterator.next();
checkWarning(annotation, 41, "Property `margin` should be written more concisely as `5px 0 0` instead of `5px 0 0 0`",
"src/search-list.component.scss", "shorthand-values", Priority.NORMAL);

annotation = iterator.next();
checkWarning(annotation, 41, "Property `margin` should be written more concisely as `5px 0 0` instead of `5px 0 0 0`",
"src/search-list.component.scss", "shorthand_values", Priority.NORMAL);
}

/**
* MSBuildParser should make relative paths absolute, based on the project name listed in the message.
* @throws IOException
Expand Down
@@ -0,0 +1,2 @@
src/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`
src/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`

0 comments on commit 729edda

Please sign in to comment.