Skip to content

Commit

Permalink
fix: ensure skip dimensions are valid
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Sep 25, 2024
1 parent 871dafd commit ea31d7d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/core/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func (f *File) FindLoc(ctx, s string, pad, count int, a Alert) (int, []int) {
func (f *File) assignLoc(ctx string, blk nlp.Block, pad int, a Alert) (int, []int) {
loc := a.Span
for idx, l := range strings.SplitAfter(ctx, "\n") {
if loc[0] < 0 || loc[1] < 0 {
continue
}
// NOTE: This fixes #473, but the real issue is that `blk.Line` is
// wrong. This seems related to `location.go#41`, but I'm not sure.
//
Expand Down
1 change: 1 addition & 0 deletions testdata/fixtures/checks/Sequence/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LanguageTool.OF_ALL_TIMES = YES
LanguageTool.APOS_ARE = YES
LanguageTool.Metadata = YES
LanguageTool.ARE_USING = YES
LanguageTool.AMBIG = YES
10 changes: 10 additions & 0 deletions testdata/styles/LanguageTool/AMBIG.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
extends: sequence
message: "Avoid ambiguous pronouns"
level: warning
ignorecase: true
tokens:
- tag: NN|NNP|NNPS|NNS
skip: 7
- tag: PRP|PRP$
pattern: he|she|its?|they|his|her|their

0 comments on commit ea31d7d

Please sign in to comment.