Skip to content

Commit

Permalink
Merge pull request #831 from cloudflare/lines
Browse files Browse the repository at this point in the history
Anchor BitBucket comments on the last line
  • Loading branch information
prymitive authored Dec 19, 2023
2 parents ecb4c97 + 6a1213b commit d6de815
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions cmd/pint/tests/0100_ci_alerts_count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ exec git commit -am 'v2'
env BITBUCKET_AUTH_TOKEN="12345"
pint.ok -l debug --no-color ci
! stdout .
stderr '{"path":"rules.yml","message":"alerts/count:.*,"line":3}'
stderr '{"path":"rules.yml","message":"alerts/count:.*,"line":7}'
stderr '{"path":"rules.yml","message":"alerts/count:.*,"line":4}'
stderr '{"path":"rules.yml","message":"alerts/count:.*,"line":11}'

-- src/v1.yml --
- alert: alert1
Expand All @@ -44,11 +44,15 @@ stderr '{"path":"rules.yml","message":"alerts/count:.*,"line":7}'
-- src/v2.yml --
- alert: alert1
# pint disable promql/series(prom)
expr: up{job="foo"} == 0
expr: |
up{job="foo"} == 0
for: 5m
- alert: alert2
# pint disable promql/series(prom)
expr: up{job="foo"} == 0
expr: |
up{job="foo"}
==
0
for: 1m

-- src/.pint.hcl --
Expand Down
5 changes: 4 additions & 1 deletion internal/reporter/bitbucket_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ func (bb bitBucketAPI) makeComments(summary Summary, changes *bitBucketPRChanges
pending := pendingComment{
severity: severity,
path: reports[0].ReportedPath,
line: reports[0].Problem.Lines.First,
line: reports[0].Problem.Lines.Last,
text: buf.String(),
anchor: reports[0].Problem.Anchor,
}
Expand Down Expand Up @@ -856,6 +856,9 @@ func dedupReports(src []Report) (dst [][]Report) {
if d[0].Problem.Lines.First != report.Problem.Lines.First {
continue
}
if d[0].Problem.Lines.Last != report.Problem.Lines.Last {
continue
}
if d[0].Problem.Anchor != report.Problem.Anchor {
continue
}
Expand Down

0 comments on commit d6de815

Please # to comment.