Skip to content

Commit

Permalink
fix: correct issue position column resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
etilite committed Aug 15, 2024
1 parent eed2760 commit 4e04496
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 4e04496

Please sign in to comment.