From 4e04496ac66df0e233261783460fed5166c06e53 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 16 Aug 2024 01:10:43 +0300 Subject: [PATCH] fix: correct issue position column resolve --- checks.go | 2 +- checks_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/checks.go b/checks.go index 0e53c22..9b198d9 100644 --- a/checks.go +++ b/checks.go @@ -171,7 +171,7 @@ func checkCapital(c comment) []Issue { if state == endOfSentence && unicode.IsLower(r) { pp = append(pp, position{ line: pos.line, - column: runeToByteColumn(c.text, pos.column), + column: runeToByteColumn(c.lines[pos.line-1], pos.column), }) } state = empty diff --git a/checks_test.go b/checks_test.go index 92057d6..42902b3 100644 --- a/checks_test.go +++ b/checks_test.go @@ -337,6 +337,17 @@ func TestCheckCapital(t *testing.T) { {Pos: token.Position{Line: 1, Column: 23}}, }, }, + { + name: "issue position column resolved from correct line", + comment: comment{ + lines: []string{"// Кириллица.", "// Issue. here."}, + text: " Кириллица.\n Issue. here.", + start: start, + }, + issues: []Issue{ + {Pos: token.Position{Line: 2, Column: 11}}, + }, + }, { name: "sentence with leading spaces", comment: comment{