@Test public void should_parse_golint_report_line() { String line = "./vendor/github.com/foo/go-bar/hello_world.go:550:12: redundant or: n == 2 || n == 2"; org.sonar.go.externalreport.ExternalIssue issue = new GoLintReportSensor().parse(line); assertThat(issue).isNotNull(); assertThat(issue.linter).isEqualTo("golint"); assertThat(issue.type).isEqualTo(RuleType.CODE_SMELL); assertThat(issue.ruleKey).isEqualTo(GENERIC_ISSUE_KEY); 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_LINT_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.CODE_SMELL, null, filename, lineNumber, message); } else { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }
GoLintReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_LINT_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.CODE_SMELL, null, filename, lineNumber, message); } else { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; } }
GoLintReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_LINT_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.CODE_SMELL, null, filename, lineNumber, message); } else { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }  }
GoLintReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_LINT_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.CODE_SMELL, null, filename, lineNumber, message); } else { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }   }
GoLintReportSensor extends AbstractReportSensor { @Nullable @Override ExternalIssue parse(String line) { Matcher matcher = GO_LINT_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.CODE_SMELL, null, filename, lineNumber, message); } else { LOG.debug(logPrefix() + "Unexpected line: " + line); } return null; }   static final String PROPERTY_KEY; static final String LINTER_ID; static final String LINTER_NAME; }