Skip to content

Add option to exclude matches matching #33

@Jeehut

Description

@Jeehut

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions