@Test public void issues_when_xml_file_has_errors() throws IOException { List<ExternalIssue> externalIssues = importIssues("detekt-checkstyle-with-errors.xml"); assertThat(externalIssues).hasSize(2); ExternalIssue first = externalIssues.get(0); assertThat(first.primaryLocation().inputComponent().key()).isEqualTo("externalreport-project:main.kt"); assertThat(first.ruleKey().rule()).isEqualTo("detekt.UnknownRuleKey"); assertThat(first.type()).isEqualTo(RuleType.CODE_SMELL); assertThat(first.severity()).isEqualTo(Severity.MAJOR); assertThat(first.primaryLocation().message()).isEqualTo("Error at file level with an unknown rule key."); assertThat(first.primaryLocation().textRange()).isNull(); assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty(); assertThat(logTester.logs(LoggerLevel.WARN)).containsExactlyInAnyOrder( "No input file found for not-existing-file.kt. No test-linter issues will be imported on this file."); assertThat(logTester.logs(LoggerLevel.DEBUG)).containsExactlyInAnyOrder( "Unexpected error without any message for rule: 'detekt.EmptyIfBlock'"); }
protected Severity severity(String ruleKey, @Nullable String severity) { return "info".equals(severity) ? Severity.MINOR : Severity.MAJOR; }
CheckstyleFormatImporter { protected Severity severity(String ruleKey, @Nullable String severity) { return "info".equals(severity) ? Severity.MINOR : Severity.MAJOR; } }
CheckstyleFormatImporter { protected Severity severity(String ruleKey, @Nullable String severity) { return "info".equals(severity) ? Severity.MINOR : Severity.MAJOR; } CheckstyleFormatImporter(SensorContext context, String linterKey); }
CheckstyleFormatImporter { protected Severity severity(String ruleKey, @Nullable String severity) { return "info".equals(severity) ? Severity.MINOR : Severity.MAJOR; } CheckstyleFormatImporter(SensorContext context, String linterKey); void importFile(File reportPath); }
CheckstyleFormatImporter { protected Severity severity(String ruleKey, @Nullable String severity) { return "info".equals(severity) ? Severity.MINOR : Severity.MAJOR; } CheckstyleFormatImporter(SensorContext context, String linterKey); void importFile(File reportPath);  }