Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated words rule gives false positives too often #35

Open
evilnick opened this issue Jun 10, 2024 · 2 comments
Open

Repeated words rule gives false positives too often #35

evilnick opened this issue Jun 10, 2024 · 2 comments

Comments

@evilnick
Copy link
Contributor

evilnick commented Jun 10, 2024

Particularly with web pages

e.g. <a href="something/plop">Plop</a> will trigger this rule

@SecondSkoll
Copy link
Contributor

Adding some negative lookahead / lookbehind should clear up some of these issues. If you've got a lot of this happening, would you be able to show some more examples so we can try and address them all?

You can run against this rule specifically with vale --filter '.Name=="Canonical.000-Repeated-words"'.

@SecondSkoll
Copy link
Contributor

So upon investigation and running some tests in Vale studio, it seems like the logic built into the repetition extension point might be broken. Not that I know much Golang, but this line seems like it's designed to catch repeated terms across multiple lines - but it doesn't seem to be functioning.

It seems that the repetition rule turns the token into a capture group after the rule is implemented and runs against the captured content, so we can't implement negative lookahead/behind in the logic for a repetition based rule.

However, we can use the general existence extension to implement our own logic for this rule.

extends: existence
message: "Repeated words '%s'!"
level: error
ignorecase: true
tokens:
  - '([\S]+)( |\n)\1'

This should only provide output in the case of two words (capitalised or not) separated by either a space or a new line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants