Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.
Permalink
Browse files
Support '-' and '_' in category with MSBuildParser
  • Loading branch information
johnmcase committed May 22, 2018
1 parent febf22e commit 729eddae4d762cfe38926df8f3965416d21b4741
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
@@ -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*(.*)))$";

/**
@@ -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
@@ -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.