You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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, as1981
is more readable than1_981
.Suggested Solution
Add an option to exclude matches matching a given regex, for example by adding a new
excludeMatchesMatching
regex tocheckFileContents
.Example Usage
With the
regex
being(\d+)(\d{3})
, one could provide anexcludeMatchesMatching
of(1[4-9]|20)\d{2}
to skip violations for numbers between 1400 & 2099 – this solves the problem.Possible Involvement
The text was updated successfully, but these errors were encountered: