Search in sources :

Example 1 with FullFileModel

use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.

the class CodenarcParserTest method testParseFullBuildModelFromFile.

@Test
public void testParseFullBuildModelFromFile() throws Exception {
    FullBuildModel model = getFullBuildModel("CodeNarcXmlReport.xml");
    FullFileModel fileModel = model.getFileModel("grails-app/controllers/LoginController.groovy");
    assertEquals("Number of violations is incorrect", 10, model.getCountNumber("codenarc"));
    assertEquals("Number of files is incorrect", 7, model.getFileModelMap().size());
    assertNotNull("LoginController model is null", fileModel.getSourceFile());
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) FullFileModel(hudson.plugins.violations.model.FullFileModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 2 with FullFileModel

use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.

the class PerlCriticParser method getFileModel.

private FullFileModel getFileModel(FullBuildModel model, String name) {
    File sourceFile = this.absoluteFileFinder.getFileForName(name);
    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;
}
Also used : FullFileModel(hudson.plugins.violations.model.FullFileModel) File(java.io.File)

Example 3 with FullFileModel

use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.

the class PMDParser 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("violation")) {
        fileModel.addViolation(parseViolationElement());
    }
    endElement();
}
Also used : FullFileModel(hudson.plugins.violations.model.FullFileModel)

Example 4 with FullFileModel

use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.

the class PyLintParser 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;
}
Also used : FullFileModel(hudson.plugins.violations.model.FullFileModel) File(java.io.File)

Example 5 with FullFileModel

use of hudson.plugins.violations.model.FullFileModel in project violations-plugin by jenkinsci.

the class ReSharperParser method getFileModel.

private FullFileModel getFileModel(final FullBuildModel model, final String name, final File sourceFile) {
    final FullFileModel fileModel = model.getFileModel(name);
    final 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;
}
Also used : FullFileModel(hudson.plugins.violations.model.FullFileModel) File(java.io.File)

Aggregations

FullFileModel (hudson.plugins.violations.model.FullFileModel)32 File (java.io.File)15 Violation (hudson.plugins.violations.model.Violation)12 ViolationsParserTest (hudson.plugins.violations.ViolationsParserTest)3 FullBuildModel (hudson.plugins.violations.model.FullBuildModel)3 Test (org.junit.Test)3 Element (org.w3c.dom.Element)3 AbsoluteFileFinder (hudson.plugins.violations.util.AbsoluteFileFinder)2 FilePath (hudson.FilePath)1 IOException2 (hudson.util.IOException2)1 FileInputStream (java.io.FileInputStream)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 Document (org.w3c.dom.Document)1 NodeList (org.w3c.dom.NodeList)1