@Test public void should_parse_govet_report_line() { String line = "./vendor/github.com/foo/go-bar/hello_world.go:550: redundant or: n == 2 || n == 2"; org.sonar.go.externalreport.ExternalIssue issue = new GoVetReportSensor().parse(line); assertThat(issue).isNotNull(); assertThat(issue.linter).isEqualTo("govet"); assertThat(issue.type).isEqualTo(RuleType.BUG); assertThat(issue.ruleKey).isEqualTo("bool"); assertThat(issue.filename).isEqualTo("./vendor/github.com/foo/go-bar/hello_world.go"); assertThat(issue.lineNumber).isEqualTo(550); assertThat(issue.message).isEqualTo("redundant or: n == 2 || n == 2"); }
@Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_VET_LINE_REGEX.matcher(line); if (matcher.matches()) { String filename = matcher.group("file").trim(); int lineNumber = Integer.parseInt(matcher.group("line").trim()); String message = matcher.group("message").trim(); return new ExternalIssue(LINTER_ID, RuleType.BUG, null, filename, lineNumber, message); } else if (!line.startsWith("exit status")) { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }
GoVetReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_VET_LINE_REGEX.matcher(line); if (matcher.matches()) { String filename = matcher.group("file").trim(); int lineNumber = Integer.parseInt(matcher.group("line").trim()); String message = matcher.group("message").trim(); return new ExternalIssue(LINTER_ID, RuleType.BUG, null, filename, lineNumber, message); } else if (!line.startsWith("exit status")) { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; } }
GoVetReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_VET_LINE_REGEX.matcher(line); if (matcher.matches()) { String filename = matcher.group("file").trim(); int lineNumber = Integer.parseInt(matcher.group("line").trim()); String message = matcher.group("message").trim(); return new ExternalIssue(LINTER_ID, RuleType.BUG, null, filename, lineNumber, message); } else if (!line.startsWith("exit status")) { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }  }
GoVetReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_VET_LINE_REGEX.matcher(line); if (matcher.matches()) { String filename = matcher.group("file").trim(); int lineNumber = Integer.parseInt(matcher.group("line").trim()); String message = matcher.group("message").trim(); return new ExternalIssue(LINTER_ID, RuleType.BUG, null, filename, lineNumber, message); } else if (!line.startsWith("exit status")) { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }   }
GoVetReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_VET_LINE_REGEX.matcher(line); if (matcher.matches()) { String filename = matcher.group("file").trim(); int lineNumber = Integer.parseInt(matcher.group("line").trim()); String message = matcher.group("message").trim(); return new ExternalIssue(LINTER_ID, RuleType.BUG, null, filename, lineNumber, message); } else if (!line.startsWith("exit status")) { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }   static final String PROPERTY_KEY; static final String LINTER_ID; static final String LINTER_NAME; }