From 576e5ca0cbed671899b14f72341ecc21a85ff0bb Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Fri, 9 Jun 2023 10:59:13 +0100 Subject: [PATCH] Ensure we always use modified lines --- docs/changelog.md | 1 + internal/reporter/bitbucket.go | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index a1ded406..398ca012 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,7 @@ - Rule names were not checked for correctly, allowing for rules with empty names to pass checks. +- Fixed GitHub annotations being added to unmodified lines - #645. ## v0.44.0 diff --git a/internal/reporter/bitbucket.go b/internal/reporter/bitbucket.go index a1e5ba9b..421618bb 100644 --- a/internal/reporter/bitbucket.go +++ b/internal/reporter/bitbucket.go @@ -270,11 +270,8 @@ func moveReportedLine(report Report) (reported, original int) { } } - if reported < 0 && report.Problem.Severity == checks.Fatal { - for _, ml := range report.ModifiedLines { - reported = ml - break - } + if reported < 0 && len(report.ModifiedLines) > 0 { + return report.ModifiedLines[0], original } return reported, original