This is my solution, please kindly review.

RegEx:
<DEFECT>.*?<FILENAME>(.+?)</FILENAME>.*?<LINE>(.+?)</LINE>.*?<DEFECTCODE>(.+?)</DEFECTCODE>.*?<DESCRIPTION>(.+?)</DESCRIPTION>.*?</DEFECT>

Groovy script:
// Regular Expression:
//   
<DEFECT>.*?<FILENAME>(.+?)</FILENAME>.*?<LINE>(.+?)</LINE>.*?<DEFECTCODE>(.+?)</DEFECTCODE>.*?<DESCRIPTION>(.+?)</DESCRIPTION>.*?</DEFECT>
// 
// where
//   <DEFECT> ... </DEFECT> 
//     - the tag containing 1 violation
//   .*? 
//     - zero or more characters
//   <FILENAME>(.+?)</FILENAME> 
//     - capture group 1 to get the filename
//   <LINE>(.+?)</LINE>
//     - capture group 2 to get the line number
//   <DEFECTCODE>(.+?)</DEFECTCODE>
//     - capture group 3 to get the error code
//   <DESCRIPTION>(.+?)</DESCRIPTION>
//     - capture group 4 to get the description
 
import hudson.plugins.warnings.parser.Warning
 
String fileName = matcher.group(1)
String lineNumber = matcher.group(2)
String category = matcher.group(3)
String message = matcher.group(4)
 
return new Warning(fileName, Integer.parseInt(lineNumber), "Static Code 
Analyzer (PREfast)", category, message);

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to