use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class ReSharperParser method parse.
public void parse(final FullBuildModel model, final File projectPath, final String fileName, final String[] sourcePaths) throws IOException {
absoluteFileFinder.addSourcePath(projectPath.getAbsolutePath());
absoluteFileFinder.addSourcePaths(sourcePaths);
final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
try {
docBuilder = docBuilderFactory.newDocumentBuilder();
final Document docElement = docBuilder.parse(new FileInputStream(new File(projectPath, fileName)));
NodeList nl = docElement.getElementsByTagName("IssueType");
if (nl == null)
return;
for (int i = 0; i < nl.getLength(); i++) {
final Element issueTypeElement = (Element) nl.item(i);
final IssueType issueType = parseIssueType(issueTypeElement);
issueTypes.put(issueType.getId(), issueType);
}
nl = docElement.getElementsByTagName("Issue");
if (nl == null)
return;
for (int i = 0; i < nl.getLength(); i++) {
final Element issueElement = (Element) nl.item(i);
final Issue issue = parseIssue(issueElement);
final IssueType issueType = issueTypes.get(issue.getTypeId());
if (// couldn't find the issue type, skip it
issueType == null)
continue;
final Violation violation = new Violation();
violation.setType("resharper");
violation.setMessage(issue.getMessage());
violation.setPopupMessage(issueType.getDescription() + " - " + issue.getMessage());
violation.setSource(issueType.getCategory());
violation.setLine(issue.getLine());
violation.setSeverity(SEVERITIES.get(issueType.getSeverity()));
violation.setSeverityLevel(Severity.getSeverityLevel(violation.getSeverity()));
final File file = absoluteFileFinder.getFileForName(issue.getFile());
final FullFileModel fullFileModel = getFileModel(model, issue.getFile().replace('\\', '/'), file);
fullFileModel.addViolation(violation);
}
} catch (final ParserConfigurationException pce) {
throw new IOException2(pce);
} catch (final SAXException se) {
throw new IOException2(se);
}
}
use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class ZptlintParser method getFileModel.
private FullFileModel getFileModel(FullBuildModel model, String name, File sourceFile) {
FullFileModel fileModel = model.getFileModel(name);
File other = fileModel.getSourceFile();
if (sourceFile == null || ((other != null) && (other.equals(sourceFile) || other.exists()))) {
return fileModel;
}
fileModel.setSourceFile(sourceFile);
fileModel.setLastModified(sourceFile.lastModified());
return fileModel;
}
use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class JcReportParser method parseFileElement.
private void parseFileElement() throws IOException, XmlPullParserException {
final String name = getString("name");
// consume "file" tag
getParser().next();
if (null != name && name.length() > 0) {
FullFileModel fileModel = null;
// Loop through the child elements, getting the "item" ones
while (skipToTag("item")) {
final Violation violation = parseItemElement();
if (null != violation) {
if (fileModel == null) {
fileModel = getFileModel(fixAbsolutePath(name));
}
fileModel.addViolation(parseItemElement());
}
getParser().next();
endElement();
}
}
endElement();
}
use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class JsLintParser method parseFileElement.
private void parseFileElement() throws IOException, XmlPullParserException {
String relativeName = fixAbsolutePath(checkNotBlank("name"));
File absoluteFile = absoluteFileFinder.getFileForName(relativeName);
String absoluteFileName = absoluteFile == null ? relativeName : absoluteFile.getAbsolutePath();
// consume "file" tag
getParser().next();
FullFileModel fileModel = getFileModel(absoluteFileName);
// loop thru the child elements, getting the "issue" ones
while (skipToTag("issue")) {
fileModel.addViolation(parseIssueElement());
}
endElement();
}
use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class CheckstyleParser method parseFileElement.
private void parseFileElement() throws IOException, XmlPullParserException {
String absoluteFileName = fixAbsolutePath(checkNotBlank("name"));
// consume "file" tag
getParser().next();
FullFileModel fileModel = getFileModel(absoluteFileName);
// Loop tru the child elements, getting the "error" ones
while (skipToTag("error")) {
fileModel.addViolation(parseErrorElement());
}
endElement();
}
Aggregations