errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.3k stars 144 forks source link

Incorrect suggestions with extends: substitution and ignorecase: true #835

Closed natalia-laptieva closed 1 month ago

natalia-laptieva commented 1 month ago

Check for existing issues

Environment

v3.4.1 in Vale Studio v3.4.2 in IDE (WebStorm), macOS, Vale installed with Homebrew

Describe the bug / provide steps to reproduce it

When I use the extends: substitution extension point with the ignorecase: true parameter, I expect that if I specify a word in lowercase, the matched word is corrected with lowercase and the same with uppercase. For example, e-mail will be replaced with email and E-mail with Email accordingly.

extends: substitution
message: "Use '%s' instead of '%s'."
level: error
ignorecase: true
action:
  name: replace
swap:
  e-mail: email

This is how it worked before (can't specify the version): Screenshot 2024-03-28 at 15 22 28 Now, it doesn't work like that, so E-mail is to be replaced with email, and the corresponding tests are failing: image Example with Microsoft rules:

The same behavior in the IDE with v3.4.2.

jdkato commented 1 month ago

This behavior has been moved behind the capitalize key:

# Will attempt to match capitalization of original token.
capitalize: true

The reasoning for this is that it's undesirable in any case with a fixed capitalization style (such as "iOS" or "JavaScript").