se.bjurr.violations.lib.model.Violation - java examples

Here are the examples of the java api se.bjurr.violations.lib.model.Violation taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

70 Examples 7

19 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Converts the list of violations to a corresponding report of issues.
 *
 * @param violations
 *         the violations
 *
 * @return the report
 */
protected Report convertToReport(final List<Violation> violations) {
    Report report = new Report();
    for (Violation violation : violations) {
        if (isValid(violation)) {
            report.add(convertToIssue(violation));
        }
    }
    return report;
}

19 View Complete Implementation : Utils.java
Copyright Apache License 2.0
Author : tomasbjerre
public static Set<Violation> setReporter(final Set<Violation> violations, final String reporter) {
    for (final Violation v : violations) {
        v.setReporter(reporter);
    }
    return violations;
}

19 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Converts the specified violation to a corresponding {@link Issue} instance.
 *
 * @param violation
 *         the violation
 *
 * @return corresponding {@link Issue}
 */
protected Issue convertToIssue(final Violation violation) {
    IssueBuilder builder = createIssueBuilder(violation);
    extractAdditionalProperties(builder, violation);
    return builder.build();
}

19 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Sub-clreplacedes may add additional {@link IssueBuilder} properties based on the content of the specified {@link
 * Violation}. This default implementation is empty.
 *
 * @param builder
 *         the issue builder to change
 * @param violation
 *         the violation instance
 */
protected void extractAdditionalProperties(final IssueBuilder builder, final Violation violation) {
// default implementation is empty
}

19 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Returns whether this violation is valid and should be converted to an {@link Issue}. Return {@code false} if the
 * specified violation is a false positive or should not be counted.
 *
 * @param violation
 *         the violation to check
 *
 * @return {@code true} if the violation is valid, {@code false} otherwise
 */
protected boolean isValid(final Violation violation) {
    return true;
}

18 View Complete Implementation : PitAdapter.java
Copyright MIT License
Author : jenkinsci
@Override
protected void extractAdditionalProperties(final IssueBuilder builder, final Violation violation) {
    builder.setCategory(getSpecifics(violation, STATUS));
}

18 View Complete Implementation : CodeClimateTransformer.java
Copyright Apache License 2.0
Author : tomasbjerre
private static CodeClimate toCodeClimate(final Violation v) {
    final String description = v.getMessage();
    final String fingerprint = toHash(v);
    final CodeClimateLines lines = new CodeClimateLines(v.getStartLine());
    final CodeClimateLocation location = new CodeClimateLocation(v.getFile(), lines, null);
    final CodeClimateSeverity severity = toSeverity(v.getSeverity());
    final String check_name = v.getReporter();
    final List<CodeClimateCategory> categories = new ArrayList<CodeClimateCategory>();
    categories.add(CodeClimateCategory.BUGRISK);
    return new CodeClimate(description, fingerprint, location, severity, check_name, categories);
}

18 View Complete Implementation : CodeClimateTransformer.java
Copyright Apache License 2.0
Author : tomasbjerre
private static String toHash(final Violation v) {
    MessageDigest digest;
    try {
        digest = MessageDigest.getInstance("SHA-256");
    } catch (final NoSuchAlgorithmException e) {
        return "No Hash: " + e.getMessage();
    }
    final byte[] encodedhash = digest.digest(v.toString().getBytes(StandardCharsets.UTF_8));
    final StringBuffer hexString = new StringBuffer();
    for (final byte element : encodedhash) {
        final String hex = Integer.toHexString(0xff & element);
        if (hex.length() == 1) {
            hexString.append('0');
        }
        hexString.append(hex);
    }
    return hexString.toString();
}

18 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Computes the {@link Severity} from the specified {@link SEVERITY}. Sub-clreplacedes may override and use any of the
 * properties of the provided violation.
 *
 * @param severity
 *         the severity
 * @param violation
 *         the violation instance
 *
 * @return the {@link Severity}
 */
@SuppressWarnings("unused")
protected Severity convertSeverity(final SEVERITY severity, final Violation violation) {
    if (severity == SEVERITY.ERROR) {
        return Severity.WARNING_HIGH;
    }
    if (severity == SEVERITY.WARN) {
        return Severity.WARNING_NORMAL;
    }
    return Severity.WARNING_LOW;
}

18 View Complete Implementation : PitAdapter.java
Copyright MIT License
Author : jenkinsci
@Override
protected boolean isValid(final Violation violation) {
    return "false".equals(getSpecifics(violation, DETECTED));
}

17 View Complete Implementation : TestUtils.java
Copyright Apache License 2.0
Author : tomasbjerre
public static List<Violation> filterRule(final List<Violation> all, final String rule) {
    final List<Violation> filtered = new ArrayList<>();
    for (final Violation v : all) {
        if (v.getRule().equals(rule)) {
            filtered.add(v);
        }
    }
    return filtered;
}

17 View Complete Implementation : AbstractViolationAdapter.java
Copyright MIT License
Author : jenkinsci
/**
 * Converts the specified violation to a corresponding {@link IssueBuilder} instance.
 *
 * @param violation
 *         the violation
 *
 * @return corresponding {@link IssueBuilder} instance
 */
protected IssueBuilder createIssueBuilder(final Violation violation) {
    IssueBuilder builder = new IssueBuilder();
    builder.setSeverity(convertSeverity(violation.getSeverity(), violation)).setFileName(violation.getFile()).setMessage(violation.getMessage()).setLineStart(violation.getStartLine()).setLineEnd(violation.getEndLine()).setColumnStart(violation.getColumn()).setType(violation.getRule()).setCategory(violation.getCategory());
    return builder;
}

17 View Complete Implementation : PitAdapter.java
Copyright MIT License
Author : jenkinsci
@Override
protected Severity convertSeverity(final SEVERITY severity, final Violation violation) {
    return "SURVIVED".equals(getSpecifics(violation, STATUS)) ? Severity.WARNING_HIGH : Severity.WARNING_NORMAL;
}

17 View Complete Implementation : PitAdapter.java
Copyright MIT License
Author : jenkinsci
@Nullable
private String getSpecifics(final Violation violation, final String key) {
    return violation.getSpecifics().get(key);
}

17 View Complete Implementation : CodeNarcParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(final String string) throws Exception {
    final List<Violation> violations = new ArrayList<>();
    final Map<String, String> rules = getRules(string);
    final String sourceDirectory = getSourceDirectory(string);
    try (InputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"))) {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        final XMLStreamReader xmlr = factory.createXMLStreamReader(input);
        String path = null;
        String name = null;
        String ruleName = null;
        Integer priority = null;
        Integer lineNumber = null;
        while (xmlr.hasNext()) {
            final int eventType = xmlr.next();
            if (eventType == START_ELEMENT) {
                if (xmlr.getLocalName().equalsIgnoreCase("Package")) {
                    path = getAttribute(xmlr, "path");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("File")) {
                    name = getAttribute(xmlr, "name");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("Violation")) {
                    ruleName = getAttribute(xmlr, "ruleName");
                    priority = getIntegerAttribute(xmlr, "priority");
                    final String lineNumberString = getAttribute(xmlr, "lineNumber");
                    lineNumber = 1;
                    if (!lineNumberString.isEmpty()) {
                        lineNumber = Integer.parseInt(lineNumberString);
                    }
                    String message = rules.get(ruleName);
                    if (message == null) {
                        message = ruleName;
                    }
                    String fileString = null;
                    if (sourceDirectory.isEmpty()) {
                        fileString = path + "/" + name;
                    } else {
                        fileString = sourceDirectory + "/" + path + "/" + name;
                    }
                    final Violation violation = // 
                    violationBuilder().setParser(// 
                    CODENARC).setFile(// 
                    fileString.replace("//", "/")).setMessage(// 
                    message).setRule(// 
                    ruleName).setSeverity(// 
                    getSeverity(priority)).setStartLine(// 
                    lineNumber).build();
                    violations.add(violation);
                }
            }
        }
    }
    return violations;
}

17 View Complete Implementation : GendarmeParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(String string) throws Exception {
    final List<Violation> violations = new ArrayList<>();
    try (InputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"))) {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        final XMLStreamReader xmlr = factory.createXMLStreamReader(input);
        String name = null;
        String problem = null;
        String solution = null;
        while (xmlr.hasNext()) {
            final int eventType = xmlr.next();
            if (eventType == START_ELEMENT) {
                if (xmlr.getLocalName().equalsIgnoreCase("rule")) {
                    name = getAttribute(xmlr, "Name");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("problem")) {
                    problem = xmlr.getElementText().trim();
                }
                if (xmlr.getLocalName().equalsIgnoreCase("solution")) {
                    solution = xmlr.getElementText().trim();
                }
                if (xmlr.getLocalName().equalsIgnoreCase("defect")) {
                    final String severityString = getAttribute(xmlr, "Severity");
                    final String source = getAttribute(xmlr, "Source");
                    final SEVERITY severity = getSeverity(severityString);
                    final String message = problem + "\n\n" + solution;
                    final Pattern pattern = Pattern.compile("^(.*)\\(.([0-9]*)\\)$");
                    final Matcher matcher = pattern.matcher(source);
                    if (matcher.matches()) {
                        final String filepath = matcher.group(1);
                        final Integer lineNumber = Integer.parseInt(matcher.group(2));
                        final Violation violation = // 
                        violationBuilder().setParser(// 
                        GENDARME).setFile(// 
                        filepath).setMessage(// 
                        message).setRule(// 
                        name).setSeverity(// 
                        severity).setStartLine(// 
                        lineNumber).build();
                        violations.add(violation);
                    }
                }
            }
        }
    }
    return violations;
}

16 View Complete Implementation : CppCheckAdapter.java
Copyright MIT License
Author : jenkinsci
@Override
protected Report convertToReport(final List<Violation> violations) {
    final Map<String, List<Violation>> violationsPerGroup = violations.stream().collect(Collectors.groupingBy(Violation::getGroup));
    Report report = new Report();
    for (List<Violation> group : violationsPerGroup.values()) {
        IssueBuilder issueBuilder = createIssueBuilder(group.get(0));
        LineRangeList lineRanges = new LineRangeList();
        for (int i = 1; i < group.size(); i++) {
            Violation violation = group.get(i);
            lineRanges.add(new LineRange(violation.getStartLine()));
        }
        issueBuilder.setLineRanges(lineRanges);
        report.add(issueBuilder.build());
    }
    return report;
}

16 View Complete Implementation : DocFxAdapter.java
Copyright MIT License
Author : jenkinsci
@Override
protected boolean isValid(final Violation violation) {
    SEVERITY severity = violation.getSeverity();
    return severity != SEVERITY.INFO;
}

16 View Complete Implementation : ZPTLintParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(String string) throws Exception {
    List<Violation> violations = new ArrayList<>();
    for (List<String> parts : getLines(string, "[ ]+Error in: (.*)  (.*)  , at line (\\d+).*")) {
        if (parts.size() < 3) {
            continue;
        }
        Integer lineInFile = Integer.parseInt(parts.get(3));
        String message = parts.get(2);
        String fileName = parts.get(1);
        Violation violation = // 
        violationBuilder().setParser(// 
        ZPTLINT).setFile(// 
        fileName).setMessage(// 
        message).setRule(// 
        "ZPT").setSeverity(// 
        ERROR).setStartLine(// 
        lineInFile).build();
        violations.add(violation);
    }
    return violations;
}

16 View Complete Implementation : Filtering.java
Copyright Apache License 2.0
Author : tomasbjerre
public static List<Violation> withAtLEastSeverity(List<Violation> unfiltered, final SEVERITY severity) {
    List<Violation> filtered = new ArrayList<>();
    for (Violation candidate : unfiltered) {
        if (isSeverer(candidate.getSeverity(), severity)) {
            filtered.add(candidate);
        }
    }
    return filtered;
}

15 View Complete Implementation : ViolationsApi.java
Copyright Apache License 2.0
Author : tomasbjerre
public List<Violation> violations() {
    final List<File> includedFiles = findAllReports(startFile, pattern);
    if (LOG.isLoggable(FINE)) {
        LOG.log(FINE, "Found " + includedFiles.size() + " reports:");
        for (final File f : includedFiles) {
            LOG.log(FINE, f.getAbsolutePath());
        }
    }
    final Set<Violation> foundViolations = parser.findViolations(includedFiles);
    final boolean reporterWreplacedupplied = reporter != null && !reporter.trim().isEmpty() && !reporter.equals(parser.name());
    if (reporterWreplacedupplied) {
        setReporter(foundViolations, reporter);
    }
    if (LOG.isLoggable(FINE)) {
        LOG.log(FINE, "Found " + foundViolations.size() + " violations:");
        for (final Violation v : foundViolations) {
            LOG.log(FINE, v.getReporter() + " " + v.getSeverity() + " (" + v.getRule() + ") " + v.getFile() + " " + v.getStartLine() + " -> " + v.getEndLine());
        }
    }
    return new ArrayList<Violation>(foundViolations);
}

15 View Complete Implementation : CodeNarcTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedEmptySourceFolder() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/codenarc/CodeNarcXmlReport\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    CODENARC).violations();
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getFile()).isEqualTo("grails-app/controllers/LoginController.groovy");
}

15 View Complete Implementation : CPPCheckTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedExample1() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/cppcheck/example1\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    CPPCHECK).violations();
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("Variable 'it' is rereplacedigned a value before the old one has been used.");
    final Violation violation1 = actual.get(1);
    // 
    replacedertThat(violation1.getMessage()).isEqualTo("Variable 'it' is rereplacedigned a value before the old one has been used.");
    final Violation violation2 = actual.get(2);
    // 
    replacedertThat(violation2.getMessage()).isEqualTo("Condition 'rc' is always true");
    final Violation violation3 = actual.get(3);
    // 
    replacedertThat(violation3.getMessage()).isEqualTo("Condition 'rc' is always true. replacedignment 'rc=true', replacedigned value is 1");
}

15 View Complete Implementation : FindbugsTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedFromSpotbugs2() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/findbugs/spotbugs-main\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    FINDBUGS).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getFile()).isEqualTo("se/bjurr/violations/lib/reports/ReportsFinder.java");
}

15 View Complete Implementation : Flake8Test.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedFromFileContainingNoise() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/flake8/flake8-failure\\.log$").inFolder(// 
    rootFolder).findAll(// 
    FLAKE8).violations();
    // 
    replacedertThat(actual).hreplacedize(6);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).startsWith("HOME=/var/jenkins_home/workspace/");
}

14 View Complete Implementation : CPDParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(String string) throws Exception {
    final List<Violation> violations = new ArrayList<>();
    try (InputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"))) {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        final XMLStreamReader xmlr = factory.createXMLStreamReader(input);
        final List<String> files = new ArrayList<>();
        final List<Integer> filesLine = new ArrayList<>();
        Integer tokens = null;
        while (xmlr.hasNext()) {
            final int eventType = xmlr.next();
            if (eventType == START_ELEMENT) {
                if (xmlr.getLocalName().equalsIgnoreCase("duplication")) {
                    tokens = getIntegerAttribute(xmlr, "tokens");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("file")) {
                    files.add(getAttribute(xmlr, "path"));
                    filesLine.add(getIntegerAttribute(xmlr, "line"));
                }
                if (xmlr.getLocalName().equalsIgnoreCase("codefragment")) {
                    final String codefragment = xmlr.getElementText().trim();
                    for (int i = 0; i < filesLine.size(); i++) {
                        final String file = files.get(i);
                        final Integer line = filesLine.get(i);
                        final Violation violation = // 
                        violationBuilder().setParser(// 
                        CPD).setFile(// 
                        file).setMessage(// 
                        codefragment).setRule(// 
                        "DUPLICATION").setSeverity(// 
                        getSeverity(tokens)).setStartLine(// 
                        line).build();
                        violations.add(violation);
                    }
                    files.clear();
                    filesLine.clear();
                }
            }
        }
    }
    return violations;
}

14 View Complete Implementation : PMDTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatPHPMDViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/pmd/phpmd\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    PMD).violations();
    // 
    replacedertThat(actual).hreplacedize(2);
    final Violation violationZero = actual.get(0);
    // 
    replacedertThat(violationZero.getFile()).isEqualTo("/home/bjerre/workspace/pull-request-notifier-for-stash/api.php");
    // 
    replacedertThat(violationZero.getMessage()).startsWith("Avoid unused");
}

14 View Complete Implementation : SonarTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedWithIssuesReportVersion7_5() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/sonar/sonar-report-3\\.json$").inFolder(// 
    rootFolder).findAll(// 
    SONAR).violations();
    // 
    replacedertThat(actual).hreplacedize(5);
    final Violation actualViolationZero = actual.get(4);
    // 
    replacedertThat(actualViolationZero.getFile()).isEqualTo("src/main/java/com/example/component/application/providers/WebProvider.java");
    // 
    replacedertThat(actualViolationZero.getStartLine()).isEqualTo(56);
    // 
    replacedertThat(actualViolationZero.getMessage()).isEqualTo("Complete the task replacedociated to this TODO comment.");
    final Violation actualViolationFour = actual.get(0);
    // 
    replacedertThat(actualViolationFour.getMessage()).isEqualTo("'PreplacedWORD' detected in this expression, review this potentially hard-coded credential.");
}

13 View Complete Implementation : FxCopTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/fxcop/.*\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    FXCOP).violations();
    // 
    replacedertThat(actual).hreplacedize(25);
    final Violation actualViolationZero = actual.get(0);
    // 
    replacedertThat(actualViolationZero.getFile()).isEqualTo("C:/git/test-project/Test Solution 1/GenericsSample/Form1.Designer.cs");
    // 
    replacedertThat(actualViolationZero.getStartLine()).isEqualTo(288);
    // 
    replacedertThat(actualViolationZero.getMessage()).startsWith("Method 'Form");
    // 
    replacedertThat(actualViolationZero.getReporter()).isEqualTo(FXCOP.name());
    // 
    replacedertThat(actualViolationZero.getRule()).isEqualTo("Do not preplaced literals as localized parameters");
    // 
    replacedertThat(actualViolationZero.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(actualViolationZero.getSource()).isEqualTo("Form1");
    // 
    replacedertThat(actualViolationZero.getSpecifics().get("TARGET_NAME")).isEqualTo("C:/git/test-project/Test Solution 1/GenericsSample/bin/Debug/GenericsSample.exe");
    final Violation actualViolationOne = actual.get(1);
    // 
    replacedertThat(actualViolationOne.getFile()).isEqualTo("C:/git/test-project/Test Solution 1/GenericsSample/Form1.Designer.cs");
    // 
    replacedertThat(actualViolationOne.getStartLine()).isEqualTo(275);
    // 
    replacedertThat(actualViolationOne.getMessage()).startsWith("Correct the spell");
    // 
    replacedertThat(actualViolationOne.getReporter()).isEqualTo(FXCOP.name());
    // 
    replacedertThat(actualViolationOne.getRule()).isEqualTo("Literals should be spelled correctly");
    // 
    replacedertThat(actualViolationOne.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(actualViolationOne.getSource()).isEqualTo("Form1");
    // 
    replacedertThat(actualViolationOne.getSpecifics().get("TARGET_NAME")).isEqualTo("C:/git/test-project/Test Solution 1/GenericsSample/bin/Debug/GenericsSample.exe");
}

13 View Complete Implementation : JSHintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    String rootFolder = getRootFolder();
    List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/jshint/.*\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    JSLINT).violations();
    // 
    replacedertThat(actual).hreplacedize(6);
    Violation violation = actual.get(2);
    // 
    replacedertThat(violation.getFile()).isEqualTo("../../../web/js-file.js");
    // 
    replacedertThat(violation.getMessage()).startsWith(// 
    "Use").doesNotContain("CDATA");
    // 
    replacedertThat(violation.getStartLine()).isEqualTo(4);
    // 
    replacedertThat(violation.getEndLine()).isEqualTo(4);
    // 
    replacedertThat(violation.getSeverity()).isEqualTo(WARN);
}

13 View Complete Implementation : PCLintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatSeverityAndRulenumberFromMisraTakesPrecedence() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/pclint/.*\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    PCLINT).violations();
    Violation violation = actual.get(5);
    replacedertThat(violation.getRule()).isEqualTo("MISRA 2012 Rule 10.4, mandatory");
    replacedertThat(violation.getSeverity()).isEqualTo(ERROR);
    violation = actual.get(4);
    replacedertThat(violation.getRule()).isEqualTo("MISRA 2012 Rule 1.3, required");
    replacedertThat(violation.getSeverity()).isEqualTo(WARN);
    violation = actual.get(7);
    replacedertThat(violation.getRule()).isEqualTo("MISRA 2012 Rule 10.1, advisory");
    replacedertThat(violation.getSeverity()).isEqualTo(INFO);
    replacedertThat(violation.getMessage()).isEqualTo("Bad type (Error <a href=\"/userContent/LintMsgRef.html#48\">48</a>)");
}

12 View Complete Implementation : JCReportParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(String string) throws Exception {
    final List<Violation> violations = new ArrayList<>();
    try (InputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"))) {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        final XMLStreamReader xmlr = factory.createXMLStreamReader(input);
        String name = null;
        String findingType = null;
        Integer line = null;
        String message = null;
        String origin = null;
        String severity = null;
        while (xmlr.hasNext()) {
            final int eventType = xmlr.next();
            if (eventType == START_ELEMENT) {
                if (xmlr.getLocalName().equalsIgnoreCase("file")) {
                    name = getAttribute(xmlr, "name");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("item")) {
                    findingType = getAttribute(xmlr, "finding-type");
                    line = getIntegerAttribute(xmlr, "line");
                    message = getAttribute(xmlr, "message");
                    origin = getAttribute(xmlr, "origin");
                    severity = getAttribute(xmlr, "severity");
                    final Violation violation = // 
                    violationBuilder().setParser(// 
                    JCREPORT).setFile(// 
                    name).setMessage(// 
                    message).setRule(// 
                    findingType + "(" + origin + ")").setSeverity(// 
                    toSeverity(severity)).setStartLine(// 
                    line).build();
                    violations.add(violation);
                }
            }
        }
    }
    return violations;
}

12 View Complete Implementation : SimianParser.java
Copyright Apache License 2.0
Author : tomasbjerre
@Override
public List<Violation> parseReportOutput(String string) throws Exception {
    final List<Violation> violations = new ArrayList<>();
    try (InputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"))) {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        final XMLStreamReader xmlr = factory.createXMLStreamReader(input);
        String sourceFile = null;
        Integer lineCount = null;
        Integer startLineNumber = null;
        Integer endLineNumber = null;
        while (xmlr.hasNext()) {
            final int eventType = xmlr.next();
            if (eventType == START_ELEMENT) {
                if (xmlr.getLocalName().equalsIgnoreCase("set")) {
                    lineCount = getIntegerAttribute(xmlr, "lineCount");
                }
                if (xmlr.getLocalName().equalsIgnoreCase("block")) {
                    sourceFile = getAttribute(xmlr, "sourceFile");
                    startLineNumber = getIntegerAttribute(xmlr, "startLineNumber");
                    endLineNumber = getIntegerAttribute(xmlr, "endLineNumber");
                    final Violation violation = // 
                    violationBuilder().setParser(// 
                    SIMIAN).setFile(// 
                    sourceFile).setMessage(// 
                    "Duplication").setRule(// 
                    "DUPLICATION").setSeverity(// 
                    toSeverity(lineCount)).setStartLine(// 
                    startLineNumber).setEndLine(// 
                    endLineNumber).build();
                    violations.add(violation);
                }
            }
        }
    }
    return violations;
}

12 View Complete Implementation : ArmGccTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/arm-gcc/output.*\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CLANG).violations();
    // 
    replacedertThat(actual).hreplacedize(4);
    final Violation violation0 = actual.get(2);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("comparison between signed and unsigned integer expressions [-Wsign-compare]");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("../../external/specific/arm/cmsis/arm_math.h");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(5774);
}

12 View Complete Implementation : CLangTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatRubycopViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/clang/rubycop\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CLANG).violations();
    // 
    replacedertThat(actual).hreplacedize(4);
    final Violation violation0 = actual.get(3);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("Use snake_case for method names.");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("test.rb");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(1);
    // 
    replacedertThat(actual.get(0).getSeverity()).isEqualTo(WARN);
}

12 View Complete Implementation : CLangTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/clang/clang.*\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CLANG).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("'test.h' file not found");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("./test.h");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(10);
    final Violation violation2 = actual.get(2);
    // 
    replacedertThat(violation2.getMessage()).isEqualTo("Memory is allocated");
    // 
    replacedertThat(violation2.getFile()).isEqualTo("main.cpp");
    // 
    replacedertThat(violation2.getSeverity()).isEqualTo(INFO);
    // 
    replacedertThat(violation2.getRule()).isEqualTo("");
    // 
    replacedertThat(violation2.getStartLine()).isEqualTo(4);
}

12 View Complete Implementation : CodeNarcTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed2() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/codenarc/SampleCodeNarc.*\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    CODENARC).violations();
    // 
    replacedertThat(actual).hreplacedize(76);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("Violations are triggered when an excessive set of consecutive statements all reference the same variable. This can be made more readable by using a with or idenreplacedy block.");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("src/test/groovy/org/codenarc/rule/AbstractAstVisitorRuleTest.groovy");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(INFO);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("UnnecessaryObjectReferences");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(188);
    // 
    replacedertThat(violation0.getEndLine()).isEqualTo(188);
}

12 View Complete Implementation : CodeNarcTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/codenarc/CodeNarc.*\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    CODENARC).violations();
    // 
    replacedertThat(actual).hreplacedize(32);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("In most cases, exceptions should not be caught and ignored (swallowed).");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("/Test.groovy");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("EmptyCatchBlock");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(192);
    // 
    replacedertThat(violation0.getEndLine()).isEqualTo(192);
    // 
    replacedertThat(actual.get(2).getMessage()).isEqualTo("Checks for throwing an instance of java.lang.Exception.");
}

12 View Complete Implementation : CppLintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedMulti() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*cpplint-multi\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CPPLINT).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    final Violation violation = actual.get(2);
    // 
    replacedertThat(violation.getMessage()).isEqualTo("No copyright message found.  You should have a line: \"Copyright [year] <Copyright Owner>\"");
    // 
    replacedertThat(violation.getFile()).isEqualTo("cpp/test.cpp");
    // 
    replacedertThat(violation.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation.getRule()).isEqualTo("legal/copyright");
    // 
    replacedertThat(violation.getStartLine()).isEqualTo(0);
    // 
    replacedertThat(violation.getEndLine()).isEqualTo(0);
    final Violation violation1 = actual.get(1);
    // 
    replacedertThat(violation1.getStartLine()).isEqualTo(5);
    // 
    replacedertThat(violation1.getEndLine()).isEqualTo(5);
}

12 View Complete Implementation : CppLintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/cpplint/cpplint\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CPPLINT).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    Violation violation = actual.get(2);
    // 
    replacedertThat(violation.getMessage()).isEqualTo("No copyright message found.  You should have a line: \"Copyright [year] <Copyright Owner>\"");
    // 
    replacedertThat(violation.getFile()).isEqualTo("cpp/test.cpp");
    // 
    replacedertThat(violation.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation.getRule()).isEqualTo("legal/copyright");
    // 
    replacedertThat(violation.getStartLine()).isEqualTo(0);
    // 
    replacedertThat(violation.getEndLine()).isEqualTo(0);
    // 
    replacedertThat(actual.get(0).getMessage()).isEqualTo("Missing space before ( in while(");
    // 
    replacedertThat(actual.get(0).getFile()).isEqualTo("cpp/test.cpp");
    // 
    replacedertThat(actual.get(0).getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(actual.get(0).getRule()).isEqualTo("whitespace/parens");
    // 
    replacedertThat(actual.get(0).getStartLine()).isEqualTo(11);
    // 
    replacedertThat(actual.get(0).getEndLine()).isEqualTo(11);
}

12 View Complete Implementation : CppLintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed2() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*cpplint-result\\.xml$").inFolder(// 
    rootFolder).findAll(// 
    CPPLINT).violations();
    // 
    replacedertThat(actual).hreplacedize(1);
    final Violation violation = actual.get(0);
    // 
    replacedertThat(violation.getMessage()).isEqualTo("Using C-style cast.  Use reinterpret_cast<uint8_t *>(...) instead");
    // 
    replacedertThat(violation.getFile()).isEqualTo("pump/src/hal/stm32f4xx/devices/spi/spi_unit0_com.c");
    // 
    replacedertThat(violation.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation.getRule()).isEqualTo("readability/casting");
    // 
    replacedertThat(violation.getStartLine()).isEqualTo(737);
    // 
    replacedertThat(violation.getEndLine()).isEqualTo(737);
}

12 View Complete Implementation : DocFXTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/docfx/.*\\.json$").inFolder(// 
    rootFolder).findAll(// 
    DOCFX).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("Invalid file link:(~/mobiilirareplacedinta/puuttuu.md).");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("mobiilirareplacedinta/json-dateandtime.md");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("InvalidFileLink");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(18);
    final Violation violation1 = actual.get(0);
    // 
    replacedertThat(violation1.getFile()).isEqualTo("mobiilirareplacedinta/json-dateandtime.md");
    // 
    replacedertThat(violation1.getMessage()).isEqualTo("Invalid file link:(~/mobiilirareplacedinta/puuttuu.md).");
    // 
    replacedertThat(violation1.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation1.getRule()).isEqualTo("InvalidFileLink");
    // 
    replacedertThat(violation1.getStartLine()).isEqualTo(18);
    final Violation violation2 = actual.get(2);
    // 
    replacedertThat(violation2.getMessage()).isEqualTo("Invalid file link:(~/missing.md#mobiilisovellus).");
    // 
    replacedertThat(violation2.getFile()).isEqualTo("sanasto.md");
    // 
    replacedertThat(violation2.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation2.getRule()).isEqualTo("InvalidFileLink");
    // 
    replacedertThat(violation2.getStartLine()).isEqualTo(63);
}

12 View Complete Implementation : DoxygenTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/doxygen/output.*\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CLANG).violations();
    // 
    replacedertThat(actual).hreplacedize(3);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("argument 'index' of command @param is not found in the argument list of arm_min_q7(q7_t *pSrc, uint32_t blockSize, q7_t *pResult, uint32_t *pIndex)");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("./pump/external/specific/arm/cmsis_dsp/StatisticsFunctions/arm_min_q7.c");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(48);
}

12 View Complete Implementation : Flake8Test.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedWithStartingDots() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/flake8/dots\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    FLAKE8).violations();
    // 
    replacedertThat(actual).hreplacedize(2);
    final Violation violation0 = actual.get(1);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("line too long (143 > 120 characters)");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("./src/init.py");
    // 
    replacedertThat(violation0.getRule()).isEqualTo("E501");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(66);
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    final Violation violation1 = actual.get(0);
    // 
    replacedertThat(violation1.getMessage()).isEqualTo("no newline at end of file");
    // 
    replacedertThat(violation1.getFile()).isEqualTo("./src/init.py");
    // 
    replacedertThat(violation1.getRule()).isEqualTo("W292");
    // 
    replacedertThat(violation1.getStartLine()).isEqualTo(254);
    // 
    replacedertThat(violation1.getSeverity()).isEqualTo(WARN);
}

12 View Complete Implementation : Flake8Test.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedWithAnsibleLint() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/ansiblelint/ansiblelint\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    FLAKE8).violations();
    // 
    replacedertThat(actual).hreplacedize(8);
    final Violation violation0 = actual.get(1);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("Commands should not change things if nothing needs doing");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("Weblogic/playbooks/getDSdetails.yml");
    // 
    replacedertThat(violation0.getRule()).isEqualTo("EANSIBLE0012");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(25);
    final Violation violation7 = actual.get(3);
    // 
    replacedertThat(violation7.getMessage()).isEqualTo("This line is just added to test W");
    // 
    replacedertThat(violation7.getRule()).isEqualTo("WANSIBLE0012");
    // 
    replacedertThat(violation7.getSeverity()).isEqualTo(WARN);
}

12 View Complete Implementation : GccTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/gcc/output.*\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    CLANG).violations();
    // 
    replacedertThat(actual).hreplacedize(2);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).isEqualTo("comparison between signed and unsigned integer expressions [-Wsign-compare]");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("../../../pump/source/util/FormattedDate.cpp");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(82);
    final Violation violation1 = actual.get(1);
    // 
    replacedertThat(violation1.getMessage()).isEqualTo("variable 'exceedingDuration' set but not used [-Wunused-but-set-variable]");
    // 
    replacedertThat(violation1.getFile()).isEqualTo("../../../pump/source/util/profile/profile_function_overlay.cpp");
    // 
    replacedertThat(violation1.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation1.getRule()).isEqualTo("");
    // 
    replacedertThat(violation1.getStartLine()).isEqualTo(112);
}

12 View Complete Implementation : GoLintTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatGoLintViolationsCanBeParsed() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/golint/golint\\.txt$").inFolder(// 
    rootFolder).findAll(// 
    GOLINT).violations();
    // 
    replacedertThat(actual).hreplacedize(7);
    Violation violation = actual.get(6);
    // 
    replacedertThat(violation.getMessage()).isEqualTo("comment on exported type RestDataSource should be of the form \"RestDataSource ...\" (with optional leading article)");
    // 
    replacedertThat(violation.getFile()).isEqualTo("src/bla/bla/bla/dataSource.go");
    // 
    replacedertThat(violation.getSeverity()).isEqualTo(INFO);
    // 
    replacedertThat(violation.getRule()).isEqualTo("");
    // 
    replacedertThat(violation.getStartLine()).isEqualTo(28);
    // 
    replacedertThat(violation.getEndLine()).isEqualTo(28);
    Violation violation2 = actual.get(1);
    // 
    replacedertThat(violation2.getMessage()).isEqualTo("declaration of err shadows declaration at journalevent.go:165: (vet shadow)  ");
    // 
    replacedertThat(violation2.getFile()).isEqualTo("journalevent.go");
    // 
    replacedertThat(violation2.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation2.getRule()).isEqualTo("");
    // 
    replacedertThat(violation2.getStartLine()).isEqualTo(182);
    // 
    replacedertThat(violation2.getEndLine()).isEqualTo(182);
}

12 View Complete Implementation : GoogleErrorProneTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedGradle() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/googleErrorProne/googleErrorProne\\.log$").inFolder(// 
    rootFolder).findAll(// 
    GOOGLEERRORPRONE).violations();
    // 
    replacedertThat(actual).hreplacedize(5);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).endsWith("Splitter.on(\",\").split(link)) {'?");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("/home/bjerre/workspace/git-changelog/git-changelog-lib/src/main/java/se/bjurr/gitchangelog/internal/integrations/github/GitHubHelper.java");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("StringSplitter");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(51);
    final Violation violation4 = actual.get(3);
    // 
    replacedertThat(violation4.getMessage()).endsWith(", otherCommitTime);'?");
    // 
    replacedertThat(violation4.getFile()).isEqualTo("home/bjerre/workspace/git-changelog/git-changelog-lib/src/main/java/se/bjurr/gitchangelog/internal/git/TraversalWork.java");
    // 
    replacedertThat(violation4.getSeverity()).isEqualTo(WARN);
    // 
    replacedertThat(violation4.getRule()).isEqualTo("BoxedPrimitiveConstructor");
    // 
    replacedertThat(violation4.getStartLine()).isEqualTo(73);
}

12 View Complete Implementation : GoogleErrorProneTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedMaven() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/googleErrorProne/googleErrorProneMaven\\.log$").inFolder(// 
    rootFolder).findAll(// 
    GOOGLEERRORPRONE).violations();
    // 
    replacedertThat(actual).hreplacedize(1);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).endsWith("row new Exception();'?");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("../examples/maven/error_prone_should_flag/src/main/java/Main.java");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("DeadException");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(20);
}

12 View Complete Implementation : GoogleErrorProneTest.java
Copyright Apache License 2.0
Author : tomasbjerre
@Test
public void testThatViolationsCanBeParsedGradleNullAway() {
    final String rootFolder = getRootFolder();
    final List<Violation> actual = // 
    violationsApi().withPattern(// 
    ".*/googleErrorProne/nullAway\\.log$").inFolder(// 
    rootFolder).findAll(// 
    GOOGLEERRORPRONE).violations();
    // 
    replacedertThat(actual).hreplacedize(2);
    final Violation violation0 = actual.get(0);
    // 
    replacedertThat(violation0.getMessage()).endsWith("nullaway )");
    // 
    replacedertThat(violation0.getFile()).isEqualTo("home/travis/build/leinardi/FloatingActionButtonSpeedDial/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java");
    // 
    replacedertThat(violation0.getSeverity()).isEqualTo(ERROR);
    // 
    replacedertThat(violation0.getRule()).isEqualTo("NullAway");
    // 
    replacedertThat(violation0.getStartLine()).isEqualTo(175);
}