From dfb54d8c3f031b07a9675c8fd5e5eb1b2c5e2af9 Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Fri, 18 Nov 2022 16:59:34 +0000 Subject: [PATCH] Avoid naked returns --- .golangci.yml | 3 +++ cmd/pint/lint.go | 2 +- internal/checks/alerts_comparison.go | 2 +- internal/checks/alerts_count.go | 4 ++-- internal/checks/alerts_for.go | 4 ++-- internal/checks/alerts_template.go | 2 +- internal/checks/base.go | 2 +- internal/checks/base_test.go | 2 +- internal/checks/promql_aggregation.go | 10 +++++----- internal/checks/promql_fragile.go | 4 ++-- internal/checks/promql_range_query.go | 4 ++-- internal/checks/promql_rate.go | 4 ++-- internal/checks/promql_regexp.go | 2 +- internal/checks/promql_series.go | 8 ++++---- internal/checks/promql_syntax.go | 2 +- internal/checks/promql_vector_matching.go | 4 ++-- internal/checks/query_cost.go | 6 +++--- internal/checks/rule_label.go | 16 ++++++++-------- internal/checks/rule_link.go | 2 +- internal/checks/rule_reject.go | 4 ++-- internal/checks/template.go | 2 +- internal/config/match.go | 4 ++-- internal/config/parser.go | 2 +- internal/discovery/git_branch.go | 2 +- internal/discovery/glob.go | 2 +- internal/git/git.go | 6 +++--- internal/parser/models.go | 22 +++++++++++----------- internal/parser/parser.go | 16 ++++++++-------- internal/parser/read.go | 2 +- internal/parser/utils/vectorselector.go | 2 +- internal/reporter/bitbucket.go | 4 ++-- internal/reporter/reporter.go | 2 +- 32 files changed, 78 insertions(+), 75 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a7d409f3..708e0e29 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,7 @@ linters: - gocritic - importas - maligned + - nakedret - prealloc - promlinter - unconvert @@ -40,3 +41,5 @@ linters-settings: local-prefixes: github.com/cloudflare/pint gofumpt: extra-rules: true + nakedret: + max-func-lines: 0 diff --git a/cmd/pint/lint.go b/cmd/pint/lint.go index 0131a667..9c1aaed4 100644 --- a/cmd/pint/lint.go +++ b/cmd/pint/lint.go @@ -119,5 +119,5 @@ func verifyOwners(entries []discovery.Entry) (reports []reporter.Report) { }, }) } - return + return reports } diff --git a/internal/checks/alerts_comparison.go b/internal/checks/alerts_comparison.go index d90e10d6..607f3f27 100644 --- a/internal/checks/alerts_comparison.go +++ b/internal/checks/alerts_comparison.go @@ -67,7 +67,7 @@ func (c ComparisonCheck) Check(ctx context.Context, path string, rule parser.Rul Severity: Warning, }) - return + return problems } func hasComparision(n promParser.Node) *promParser.BinaryExpr { diff --git a/internal/checks/alerts_count.go b/internal/checks/alerts_count.go index 6cc908c1..d7dbac27 100644 --- a/internal/checks/alerts_count.go +++ b/internal/checks/alerts_count.go @@ -65,7 +65,7 @@ func (c AlertsCheck) Check(ctx context.Context, path string, rule parser.Rule, e Text: text, Severity: severity, }) - return + return problems } if len(qr.Series.Ranges) > 0 { @@ -105,5 +105,5 @@ func (c AlertsCheck) Check(ctx context.Context, path string, rule parser.Rule, e Text: fmt.Sprintf("%s would trigger %d alert(s) in the last %s", promText(c.prom.Name(), qr.URI), alerts, output.HumanizeDuration(delta)), Severity: Information, }) - return + return problems } diff --git a/internal/checks/alerts_for.go b/internal/checks/alerts_for.go index 60b74a48..276d8a68 100644 --- a/internal/checks/alerts_for.go +++ b/internal/checks/alerts_for.go @@ -46,7 +46,7 @@ func (c AlertsForChecksFor) Check(ctx context.Context, path string, rule parser. Text: fmt.Sprintf("invalid duration: %s", err), Severity: Bug, }) - return + return problems } if d == 0 { @@ -60,5 +60,5 @@ func (c AlertsForChecksFor) Check(ctx context.Context, path string, rule parser. }) } - return + return problems } diff --git a/internal/checks/alerts_template.go b/internal/checks/alerts_template.go index 2aeb517a..0e1490f2 100644 --- a/internal/checks/alerts_template.go +++ b/internal/checks/alerts_template.go @@ -491,7 +491,7 @@ func checkMetricLabels(msg, name, text string, metricLabels []string, excludeLab } } - return + return msgs } func absentLabels(f utils.PromQLFragment) []string { diff --git a/internal/checks/base.go b/internal/checks/base.go index 3502aaec..821c96b5 100644 --- a/internal/checks/base.go +++ b/internal/checks/base.go @@ -144,7 +144,7 @@ func textAndSeverityFromError(err error, reporter, prom string, s Severity) (tex } severity = s } - return + return text, severity } func promText(name, uri string) string { diff --git a/internal/checks/base_test.go b/internal/checks/base_test.go index d5caa3cc..c27f7246 100644 --- a/internal/checks/base_test.go +++ b/internal/checks/base_test.go @@ -531,7 +531,7 @@ func generateSampleStream(labels map[string]string, from, until time.Time, step }) from = from.Add(step) } - return + return s } func checkErrorBadData(name, uri, err string) string { diff --git a/internal/checks/promql_aggregation.go b/internal/checks/promql_aggregation.go index 8f9d830f..b2cdc025 100644 --- a/internal/checks/promql_aggregation.go +++ b/internal/checks/promql_aggregation.go @@ -76,7 +76,7 @@ func (c AggregationCheck) Check(ctx context.Context, path string, rule parser.Ru }) } - return + return problems } func (c AggregationCheck) checkNode(node *parser.PromQLNode) (problems []exprProblem) { @@ -103,7 +103,7 @@ func (c AggregationCheck) checkNode(node *parser.PromQLNode) (problems []exprPro if !n.Without && !c.keep && len(n.Grouping) == 0 { // most outer aggregation is stripping a label that we want to get rid of // we can skip further checks - return + return problems } var found bool @@ -132,7 +132,7 @@ func (c AggregationCheck) checkNode(node *parser.PromQLNode) (problems []exprPro // most outer aggregation is stripping a label that we want to get rid of // we can skip further checks if found && !c.keep { - return + return problems } } else { if found && !c.keep { @@ -152,7 +152,7 @@ func (c AggregationCheck) checkNode(node *parser.PromQLNode) (problems []exprPro // most outer aggregation is stripping a label that we want to get rid of // we can skip further checks if !found && !c.keep { - return + return problems } } } @@ -177,5 +177,5 @@ NEXT: problems = append(problems, c.checkNode(child)...) } - return + return problems } diff --git a/internal/checks/promql_fragile.go b/internal/checks/promql_fragile.go index e7631da6..708d2171 100644 --- a/internal/checks/promql_fragile.go +++ b/internal/checks/promql_fragile.go @@ -47,7 +47,7 @@ func (c FragileCheck) Check(ctx context.Context, path string, rule parser.Rule, Severity: Warning, }) } - return + return problems } func (c FragileCheck) checkNode(node *parser.PromQLNode) (problems []exprProblem) { @@ -96,5 +96,5 @@ NEXT: problems = append(problems, c.checkNode(child)...) } - return + return problems } diff --git a/internal/checks/promql_range_query.go b/internal/checks/promql_range_query.go index 237b31ec..4d61c86f 100644 --- a/internal/checks/promql_range_query.go +++ b/internal/checks/promql_range_query.go @@ -85,7 +85,7 @@ func (c RangeQueryCheck) Check(ctx context.Context, path string, rule parser.Rul }) } - return + return problems } func (c RangeQueryCheck) checkNode(ctx context.Context, node *parser.PromQLNode, retention time.Duration, uri string) (problems []exprProblem) { @@ -104,5 +104,5 @@ func (c RangeQueryCheck) checkNode(ctx context.Context, node *parser.PromQLNode, problems = append(problems, c.checkNode(ctx, child, retention, uri)...) } - return + return problems } diff --git a/internal/checks/promql_rate.go b/internal/checks/promql_rate.go index 31c383c4..e0bf2872 100644 --- a/internal/checks/promql_rate.go +++ b/internal/checks/promql_rate.go @@ -72,7 +72,7 @@ func (c RateCheck) Check(ctx context.Context, path string, rule parser.Rule, ent }) } - return + return problems } func (c RateCheck) checkNode(ctx context.Context, node *parser.PromQLNode, cfg *promapi.ConfigResult, done *completedList) (problems []exprProblem) { @@ -127,7 +127,7 @@ func (c RateCheck) checkNode(ctx context.Context, node *parser.PromQLNode, cfg * problems = append(problems, c.checkNode(ctx, child, cfg, done)...) } - return + return problems } type completedList struct { diff --git a/internal/checks/promql_regexp.go b/internal/checks/promql_regexp.go index f1dea3e1..3680793e 100644 --- a/internal/checks/promql_regexp.go +++ b/internal/checks/promql_regexp.go @@ -99,5 +99,5 @@ func (c RegexpCheck) Check(ctx context.Context, path string, rule parser.Rule, e } } - return + return problems } diff --git a/internal/checks/promql_series.go b/internal/checks/promql_series.go index 6d8f4e9e..01191b20 100644 --- a/internal/checks/promql_series.go +++ b/internal/checks/promql_series.go @@ -411,7 +411,7 @@ func (c SeriesCheck) Check(ctx context.Context, path string, rule parser.Rule, e } } - return + return problems } func (c SeriesCheck) queryProblem(err error, selector string, expr parser.PromQLExpr) Problem { @@ -507,7 +507,7 @@ func getSelectors(n *parser.PromQLNode) (selectors []promParser.VectorSelector) selectors = append(selectors, getSelectors(child)...) } - return + return selectors } func stripLabels(selector promParser.VectorSelector) promParser.VectorSelector { @@ -582,7 +582,7 @@ func oldest(ranges []promapi.MetricTimeRange) (ts time.Time) { ts = r.Start } } - return + return ts } func newest(ranges []promapi.MetricTimeRange) (ts time.Time) { @@ -591,5 +591,5 @@ func newest(ranges []promapi.MetricTimeRange) (ts time.Time) { ts = r.End } } - return + return ts } diff --git a/internal/checks/promql_syntax.go b/internal/checks/promql_syntax.go index 1d9510ef..82dce0ae 100644 --- a/internal/checks/promql_syntax.go +++ b/internal/checks/promql_syntax.go @@ -41,5 +41,5 @@ func (c SyntaxCheck) Check(ctx context.Context, path string, rule parser.Rule, e Severity: Fatal, }) } - return + return problems } diff --git a/internal/checks/promql_vector_matching.go b/internal/checks/promql_vector_matching.go index ba55858f..d34ca596 100644 --- a/internal/checks/promql_vector_matching.go +++ b/internal/checks/promql_vector_matching.go @@ -57,7 +57,7 @@ func (c VectorMatchingCheck) Check(ctx context.Context, path string, rule parser }) } - return + return problems } func (c VectorMatchingCheck) checkNode(ctx context.Context, node *parser.PromQLNode) (problems []exprProblem) { @@ -198,7 +198,7 @@ NEXT: problems = append(problems, c.checkNode(ctx, child)...) } - return + return problems } func (c VectorMatchingCheck) seriesLabels(ctx context.Context, query string, ignored ...model.LabelName) (labelSets, error) { diff --git a/internal/checks/query_cost.go b/internal/checks/query_cost.go index 85abd94d..d0a22a46 100644 --- a/internal/checks/query_cost.go +++ b/internal/checks/query_cost.go @@ -48,7 +48,7 @@ func (c CostCheck) Check(ctx context.Context, path string, rule parser.Rule, ent expr := rule.Expr() if expr.SyntaxError != nil { - return + return problems } query := fmt.Sprintf("count(%s)", expr.Value.Value) @@ -62,7 +62,7 @@ func (c CostCheck) Check(ctx context.Context, path string, rule parser.Rule, ent Text: text, Severity: severity, }) - return + return problems } var series int @@ -95,5 +95,5 @@ func (c CostCheck) Check(ctx context.Context, path string, rule parser.Rule, ent Text: fmt.Sprintf("%s returned %d result(s)%s%s", promText(c.prom.Name(), qr.URI), series, estimate, above), Severity: severity, }) - return + return problems } diff --git a/internal/checks/rule_label.go b/internal/checks/rule_label.go index 7727c6b2..3b000bb0 100644 --- a/internal/checks/rule_label.go +++ b/internal/checks/rule_label.go @@ -44,7 +44,7 @@ func (c LabelCheck) Check(ctx context.Context, path string, rule parser.Rule, en problems = append(problems, c.checkAlertingRule(rule)...) } - return + return problems } func (c LabelCheck) checkRecordingRule(rule parser.Rule) (problems []Problem) { @@ -58,7 +58,7 @@ func (c LabelCheck) checkRecordingRule(rule parser.Rule) (problems []Problem) { Severity: c.severity, }) } - return + return problems } val := rule.RecordingRule.Labels.GetValue(c.key) @@ -72,12 +72,12 @@ func (c LabelCheck) checkRecordingRule(rule parser.Rule) (problems []Problem) { Severity: c.severity, }) } - return + return problems } problems = append(problems, c.checkValue(rule, val)...) - return + return problems } func (c LabelCheck) checkAlertingRule(rule parser.Rule) (problems []Problem) { @@ -91,7 +91,7 @@ func (c LabelCheck) checkAlertingRule(rule parser.Rule) (problems []Problem) { Severity: c.severity, }) } - return + return problems } val := rule.AlertingRule.Labels.GetValue(c.key) @@ -105,12 +105,12 @@ func (c LabelCheck) checkAlertingRule(rule parser.Rule) (problems []Problem) { Severity: c.severity, }) } - return + return problems } problems = append(problems, c.checkValue(rule, val)...) - return + return problems } func (c LabelCheck) checkValue(rule parser.Rule, val *parser.YamlNode) (problems []Problem) { @@ -123,5 +123,5 @@ func (c LabelCheck) checkValue(rule parser.Rule, val *parser.YamlNode) (problems Severity: c.severity, }) } - return + return problems } diff --git a/internal/checks/rule_link.go b/internal/checks/rule_link.go index cf3e22e7..b42a8ea1 100644 --- a/internal/checks/rule_link.go +++ b/internal/checks/rule_link.go @@ -126,5 +126,5 @@ func (c RuleLinkCheck) Check(ctx context.Context, path string, rule parser.Rule, log.Debug().Str("uri", uri).Str("status", resp.Status).Msg("Link request returned a valid status code") } - return + return problems } diff --git a/internal/checks/rule_reject.go b/internal/checks/rule_reject.go index 953d9425..3662d5f9 100644 --- a/internal/checks/rule_reject.go +++ b/internal/checks/rule_reject.go @@ -60,7 +60,7 @@ func (c Reject) Check(ctx context.Context, path string, rule parser.Rule, entrie problems = append(problems, c.reject(rule, ann, "annotation")...) } } - return + return problems } func (c Reject) reject(rule parser.Rule, label *parser.YamlKeyValue, kind string) (problems []Problem) { @@ -82,5 +82,5 @@ func (c Reject) reject(rule parser.Rule, label *parser.YamlKeyValue, kind string Severity: c.severity, }) } - return + return problems } diff --git a/internal/checks/template.go b/internal/checks/template.go index 889a328e..235296c8 100644 --- a/internal/checks/template.go +++ b/internal/checks/template.go @@ -88,7 +88,7 @@ func newTemplateContext(rule parser.Rule) (c TemplateContext) { } } } - return + return c } type TemplateContext struct { diff --git a/internal/config/match.go b/internal/config/match.go index b89ac57b..33c200be 100644 --- a/internal/config/match.go +++ b/internal/config/match.go @@ -249,7 +249,7 @@ func parseDurationMatch(expr string) (dm durationMatch, err error) { parts := strings.SplitN(expr, opSeparator, 2) if len(parts) == 2 { if dm.op, err = parseMatchOperation(parts[0]); err != nil { - return + return dm, err } dm.dur, err = parseDuration(parts[1]) } else { @@ -257,7 +257,7 @@ func parseDurationMatch(expr string) (dm durationMatch, err error) { dm.dur, err = parseDuration(expr) } - return + return dm, err } type durationMatch struct { diff --git a/internal/config/parser.go b/internal/config/parser.go index af206dc2..5d190055 100644 --- a/internal/config/parser.go +++ b/internal/config/parser.go @@ -22,5 +22,5 @@ func (p Parser) CompileRelaxed() (r []*regexp.Regexp) { for _, pattern := range p.Relaxed { r = append(r, regexp.MustCompile("^"+pattern+"$")) } - return + return r } diff --git a/internal/discovery/git_branch.go b/internal/discovery/git_branch.go index 8360d593..89fa24a8 100644 --- a/internal/discovery/git_branch.go +++ b/internal/discovery/git_branch.go @@ -186,5 +186,5 @@ func getOverlap(a, b []int) (o []int) { } } } - return + return o } diff --git a/internal/discovery/glob.go b/internal/discovery/glob.go index d59003d4..35a3749c 100644 --- a/internal/discovery/glob.go +++ b/internal/discovery/glob.go @@ -135,5 +135,5 @@ func walkDir(dirname string) (paths filePaths, err error) { return nil }) - return + return paths, err } diff --git a/internal/git/git.go b/internal/git/git.go index 857a2ff8..457eb493 100644 --- a/internal/git/git.go +++ b/internal/git/git.go @@ -107,8 +107,8 @@ func (gcr CommitRangeResults) String() string { return fmt.Sprintf("%s^..%s", gcr.From, gcr.To) } -func CommitRange(cmd CommandRunner, baseBranch string) (cr CommitRangeResults, err error) { - cr.Commits = []string{} +func CommitRange(cmd CommandRunner, baseBranch string) (CommitRangeResults, error) { + cr := CommitRangeResults{Commits: []string{}} out, err := cmd("log", "--format=%H", "--no-abbrev-commit", "--reverse", fmt.Sprintf("%s..HEAD", baseBranch)) if err != nil { @@ -130,7 +130,7 @@ func CommitRange(cmd CommandRunner, baseBranch string) (cr CommitRangeResults, e return cr, fmt.Errorf("empty commit range") } - return + return cr, nil } func CurrentBranch(cmd CommandRunner) (string, error) { diff --git a/internal/parser/models.go b/internal/parser/models.go index 74d684cb..0a23f2b6 100644 --- a/internal/parser/models.go +++ b/internal/parser/models.go @@ -60,7 +60,7 @@ func (fp FilePosition) FirstLine() (line int) { line = l } } - return + return line } func (fp FilePosition) LastLine() (line int) { @@ -69,7 +69,7 @@ func (fp FilePosition) LastLine() (line int) { line = l } } - return + return line } func mergeComments(node *yaml.Node) (comments []string) { @@ -82,7 +82,7 @@ func mergeComments(node *yaml.Node) (comments []string) { if node.FootComment != "" { comments = append(comments, node.FootComment) } - return + return comments } type YamlNode struct { @@ -122,7 +122,7 @@ type YamlKeyValue struct { func (ykv YamlKeyValue) Lines() (lines []int) { lines = appendLine(lines, ykv.Key.Position.Lines...) lines = appendLine(lines, ykv.Value.Position.Lines...) - return + return lines } type YamlMap struct { @@ -135,7 +135,7 @@ func (ym YamlMap) Lines() (lines []int) { for _, item := range ym.Items { lines = appendLine(lines, item.Lines()...) } - return + return lines } func (ym YamlMap) GetValue(key string) *YamlNode { @@ -202,7 +202,7 @@ type PromQLExpr struct { func (pqle PromQLExpr) Lines() (lines []int) { lines = appendLine(lines, pqle.Key.Position.Lines...) lines = appendLine(lines, pqle.Value.Position.Lines...) - return + return lines } func newPromQLExpr(key, val *yaml.Node, offset int) *PromQLExpr { @@ -242,7 +242,7 @@ func (ar AlertingRule) Lines() (lines []int) { lines = appendLine(lines, ar.Annotations.Lines()...) } slices.Sort(lines) - return + return lines } func (ar AlertingRule) Comments() (comments []string) { @@ -268,7 +268,7 @@ func (ar AlertingRule) Comments() (comments []string) { comments = append(comments, annotation.Value.Comments...) } } - return + return comments } type RecordingRule struct { @@ -284,7 +284,7 @@ func (rr RecordingRule) Lines() (lines []int) { lines = appendLine(lines, rr.Labels.Lines()...) } slices.Sort(lines) - return + return lines } func (rr RecordingRule) Comments() (comments []string) { @@ -299,7 +299,7 @@ func (rr RecordingRule) Comments() (comments []string) { comments = append(comments, label.Value.Comments...) } } - return + return comments } type ParseError struct { @@ -400,7 +400,7 @@ func (r Rule) GetComment(comment ...string) (s Comment, ok bool) { return val, ok } } - return + return s, ok } func (r Rule) GetComments(key string) (cs []Comment) { diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 64094c18..8d88921f 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -191,7 +191,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Err: fmt.Errorf("got both %s and %s keys in a single rule", recordKey, alertKey), }, } - return + return rule, isEmpty, err } if recordPart != nil && exprPart == nil { isEmpty = false @@ -201,7 +201,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Err: fmt.Errorf("missing %s key", exprKey), }, } - return + return rule, isEmpty, err } if alertPart != nil && exprPart == nil { isEmpty = false @@ -211,7 +211,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Err: fmt.Errorf("missing %s key", exprKey), }, } - return + return rule, isEmpty, err } if exprPart != nil && alertPart == nil && recordPart == nil { isEmpty = false @@ -221,7 +221,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Err: fmt.Errorf("incomplete rule, no %s or %s key", alertKey, recordKey), }, } - return + return rule, isEmpty, err } if (recordPart != nil || alertPart != nil) && len(unknownKeys) > 0 { isEmpty = false @@ -235,7 +235,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Err: fmt.Errorf("invalid key(s) found: %s", strings.Join(keys, ", ")), }, } - return + return rule, isEmpty, err } if recordPart != nil && exprPart != nil { @@ -245,7 +245,7 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Expr: *exprPart, Labels: labelsPart, }} - return + return rule, isEmpty, err } if alertPart != nil && exprPart != nil { @@ -257,10 +257,10 @@ func parseRule(content []byte, node *yaml.Node, offset int) (rule Rule, isEmpty Labels: labelsPart, Annotations: annotationsPart, }} - return + return rule, isEmpty, err } - return + return rule, isEmpty, err } func unpackNodes(node *yaml.Node) []*yaml.Node { diff --git a/internal/parser/read.go b/internal/parser/read.go index 0bf9dd1b..321df267 100644 --- a/internal/parser/read.go +++ b/internal/parser/read.go @@ -36,7 +36,7 @@ func emptyLine(line string) (emptied string) { emptied += "\n" } - return + return emptied } func hasComment(line, comment string) bool { diff --git a/internal/parser/utils/vectorselector.go b/internal/parser/utils/vectorselector.go index 5c7cab9b..caddb938 100644 --- a/internal/parser/utils/vectorselector.go +++ b/internal/parser/utils/vectorselector.go @@ -15,5 +15,5 @@ func HasVectorSelector(node *parser.PromQLNode) (vs []*promParser.VectorSelector vs = append(vs, HasVectorSelector(child)...) } - return + return vs } diff --git a/internal/reporter/bitbucket.go b/internal/reporter/bitbucket.go index 94dc68a9..9955a704 100644 --- a/internal/reporter/bitbucket.go +++ b/internal/reporter/bitbucket.go @@ -127,7 +127,7 @@ func (r BitBucketReporter) makeAnnotation(report Report, pb git.FileBlames) (ann Str("path", report.SourcePath). Str("lines", output.FormatLineRangeString(report.Problem.Lines)). Msg("Problem reported on unmodified line, skipping") - return + return annotations } var msgPrefix string @@ -166,7 +166,7 @@ func (r BitBucketReporter) makeAnnotation(report Report, pb git.FileBlames) (ann } annotations = append(annotations, a) - return + return annotations } func (r BitBucketReporter) bitBucketRequest(method, url string, body []byte) error { diff --git a/internal/reporter/reporter.go b/internal/reporter/reporter.go index 930f24ee..be6b98ee 100644 --- a/internal/reporter/reporter.go +++ b/internal/reporter/reporter.go @@ -118,7 +118,7 @@ func blameReports(reports []Report, gitCmd git.CommandRunner) (pb git.FileBlames return } } - return + return pb, nil } func shouldReport(report Report) bool {