errata-ai / vale

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

Exceptions for Spacing rule not working #894

Open j-wol opened 2 months ago

j-wol commented 2 months ago

Check for existing issues

Environment

OS: Ubuntu Linux Install method: direct download Vale version: 3.3.0

Describe the bug / provide steps to reproduce it

In my setup I make use of the following Spacing rule that warns when a dot is not followed by a space.

extends: existence message: "'%s' should have one space." level: warning nonword: true

tokens:

  • '[a-z][.][A-Z]'

Unfortunately, this rule introduces some false positives when a mail address in the form "Firstname.Lastname@domain.com" is present in the documents.

My first idea to overcome that was to make use of the "exceptions" key of the existence style:

exceptions:

  • '\S+@\S+$'

Unfortunately, that has no impact and filters nothing. I searched a bit for such issues and found this commit which (when I interpret it correctly) removed the usage of the "exceptions" key. In case my interpretation in correct, I would suggest to adopt the documentation accordingly. Otherwise, please let me know how to properly formulate exceptions.

My second try to filter out such mail addresses was to make use a Vocabulary. The newly introduced Vocabulary simply consists of a accept.txt with following entry:

'\S+@\S+$'

This has no impact as well. Then I tested a bit and put the regex in square brackets:

[\S+@\S+$]

That now unfortunately, filter out all previous findings from the Spacing rule, even valid ones like "... end of last sentence.New sentence".

Could you please provide some hints, how to exclude mail addresses of the form "Firstname.Lastname@domain.com"?