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

Rule that worked in 2.23 does not work in 2.27 #657

Closed
1 task done
Ravlen opened this issue Jul 6, 2023 · 1 comment
Closed
1 task done

Rule that worked in 2.23 does not work in 2.27 #657

Ravlen opened this issue Jul 6, 2023 · 1 comment

Comments

@Ravlen
Copy link

Ravlen commented Jul 6, 2023

Check for existing issues

  • Completed

Environment

Tested on Linux/Mac, locally and in CI/CD pipelines.

Vale 2.23 and 2.27

Describe the bug / provide steps to reproduce it

The following rule works fine in 2.23, but fails to find violations in 2.27. I only noticed because we updated our pipelines to 2.27, but I forgot to update Vale locally:

Some changes were merged into the gitlab project after we updated to 2.27, and when I ran vale locally with 2.23 the violations got picked up. So I'm not yet sure where the bug started, between 2.24 to 2.27. The rule is a scope: code rule, looking to make sure we double quote URLs in cURL examples.

You can see the two violations in this merge request (where I fixed them to use double quotes): https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125495/diffs

@jdkato
Copy link
Member

jdkato commented Jul 12, 2023

This was changed in v2.26.0 (although it shouldn't have failed silently -- that has now been fixed).

Instead of using the inline scopes (code, link, strong, and emphasis) directly, the supported approach is to now use scope: raw and match against the relevant markup.

For example,

# OLD
message: "'%s' left in text"
extends: existence
ignorecase: false
level: suggestion
scope: strong
tokens:
  - XXX
  - FIXME
  - TODO
  - NOTE
# NEW
message: "'%s' left in text"
extends: existence
ignorecase: false
level: suggestion
nonword: true
scope: raw
tokens:
  - (?<=\*\*)(?:TODO|NOTE|FIXME|XXX)(?=\*\*)

I try to avoid making these pseudo-breaking changes to rules, but the performance improvements (memory-consumption wise) are significant.

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

No branches or pull requests

2 participants