Skip to content

Commit

Permalink
fix: don't apply ignorecase to matchToken
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Aug 20, 2024
1 parent 8b3f77a commit 2348d3a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/check/substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s Substitution) Run(blk nlp.Block, _ *core.File, cfg *core.Config) ([]core
return alerts, msgErr
}

same := matchToken(expected, observed, s.Ignorecase)
same := matchToken(expected, observed, false)
if !same && !isMatch(s.exceptRe, observed) {
action := s.Fields().Action
if action.Name == "replace" && len(action.Params) == 0 {
Expand Down
2 changes: 2 additions & 0 deletions testdata/features/checks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ Feature: Checks
test.md:21:1:Bugs.TermCase:Use 'JavaScript' rather than Javascript.
test.md:21:53:Bugs.TermCase:Use 'JavaScript' rather than javascript.
test.md:23:1:Bugs.TermCase:Use 'iOS' rather than IOS.
test.md:25:1:Bugs.SameCase:Use 'MPL 2.0' instead of 'mpl 2.0'
test.md:27:1:Bugs.SameCase:Use 'MPL 2.0' instead of 'MPL2.0'
test2.md:3:1:demo.CapSub:Use 'Change to the `/etc` directory' instead of 'Change into the `/etc` directory'.
test2.md:7:1:demo.CapSub:Use 'Change to the `/home/user` directory' instead of 'Change into the `/home/user` directory'.
test2.md:9:1:demo.CapSub:Use 'Change to the `/etc/X11` directory' instead of 'Change into the `/etc/X11` directory'.
Expand Down
1 change: 1 addition & 0 deletions testdata/fixtures/checks/Substitution/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bugs.URLCtx = YES
Bugs.MatchCase = YES
Bugs.KeepCase = YES
Bugs.TermCase = YES
Bugs.SameCase = YES

[test2.md]
demo.CapSub = YES
6 changes: 6 additions & 0 deletions testdata/fixtures/checks/Substitution/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ The Mutual TLS is a good practice. VNIC is another word.
Javascript is a programming language. I developed a javascript application.

IOS is a mobile operating system.

mpl 2.0

MPL2.0

MPL 2.0
9 changes: 9 additions & 0 deletions testdata/styles/Bugs/SameCase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: substitution
ignorecase: true
level: warning
message: Use '%s' instead of '%s'
action:
name: replace
swap:
MPL: MPL
MPL[ -]?2(?:\.0)?: MPL 2.0

0 comments on commit 2348d3a

Please sign in to comment.