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

Add option to exclude matches matching #33

Open
Jeehut opened this issue May 18, 2020 · 0 comments
Open

Add option to exclude matches matching #33

Jeehut opened this issue May 18, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@Jeehut
Copy link
Member

Jeehut commented May 18, 2020

Problem Statement

Sometimes one needs a regular expression with exceptions. For example consider a regex that matches all literal numbers with 4 digits or more and reports a violation because no _ is used as a separator: (\d+)(\d{3}). This is great, but actually we want to exclude years from this, as 1981 is more readable than 1_981.

Suggested Solution

Add an option to exclude matches matching a given regex, for example by adding a new excludeMatchesMatching regex to checkFileContents.

Example Usage

With the regex being (\d+)(\d{3}), one could provide an excludeMatchesMatching of (1[4-9]|20)\d{2} to skip violations for numbers between 1400 & 2099 – this solves the problem.

Possible Involvement

  • I could help with implementation: Yes.
  • I could help with testing: Yes.
@Jeehut Jeehut added the enhancement New feature or request label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant