use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class CssLintParser method parseFileElement.
private void parseFileElement() throws IOException, XmlPullParserException {
String absoluteFileName = fixAbsolutePath(checkNotBlank("name"));
// 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 AbstractTypeParser method getFileModel.
// -----------------------------------------------
//
// Utility methods
//
// -----------------------------------------------
/**
* Get the full file model for a particular relative name and
* source file.
* @param name the relative file name.
* @param sourceFile the source file for the file.
* @return the full file model.
*/
protected FullFileModel getFileModel(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 ViolationsDOMParser method getFileModel.
// -----------------------------------------------
//
// Utility methods
//
// -----------------------------------------------
/**
* Get the full file model for a particular relative name and
* source file.
* @param name the relative file name.
* @param sourceFile the source file for the file.
* @return the full file model.
*/
protected FullFileModel getFileModel(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 CppLintParser method parseLine.
/**
* Parses a CppLint line and adding a violation if regex
* @param model build model to add violations to
* @param line the line in the file.
* @param projectPath the path to use to resolve the file.
*/
public void parseLine(FullBuildModel model, String line, File projectPath) {
CppLintViolation cppLintViolation = getCppLintViolation(line);
if (cppLintViolation != null) {
Violation violation = new Violation();
violation.setType("cpplint");
violation.setLine(cppLintViolation.getLineStr());
violation.setMessage(cppLintViolation.getMessage());
violation.setSource(cppLintViolation.getViolationId());
setServerityLevel(violation, cppLintViolation.getConfidence());
FullFileModel fileModel = getFileModel(model, cppLintViolation.getFileName(), absoluteFileFinder.getFileForName(cppLintViolation.getFileName()));
fileModel.addViolation(violation);
}
}
use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.
the class PyflakesParser method parseLine.
/**
* Parses a Pyflakes line and adding a violation if regex
*
* @param model
* build model to add violations to
* @param line
* the line in the file.
* @param projectPath
* the path to use to resolve the file.
*/
public void parseLine(FullBuildModel model, String line, File projectPath) {
PyflakesViolation pyFlakesViolation = getPyflakesViolation(line);
if (pyFlakesViolation != null) {
Violation violation = new Violation();
violation.setType("pyflakes");
violation.setLine(pyFlakesViolation.getLineStr());
violation.setMessage(pyFlakesViolation.getMessage());
violation.setSource(pyFlakesViolation.getViolationId());
setServerityLevel(violation, pyFlakesViolation.getViolationId());
FullFileModel fileModel = getFileModel(model, pyFlakesViolation.getFileName(), absoluteFileFinder.getFileForName(pyFlakesViolation.getFileName()));
fileModel.addViolation(violation);
}
}
Aggregations