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

ruleguard: associate rule line with a pattern string #272

Merged
merged 1 commit into from Oct 12, 2021

Conversation

quasilyte
Copy link
Owner

In a multi-pattern rule, it's more useful to give a source line
of a respective pattern.

Consider this example:

     //line1: m.Match(
     //line2:        `foo()`,
     //line3:        `bar()`,
     //line4: )

Previously, if either foo() or bar() would match, we would
have a matchInfo rule line set to line1, since it's a
rule definition line (Match expression location).

Now we'll have a rule line set to line1 if foo() matches,
otherwise line2 if bar() matches. This is useful during
both debugging and rules usage.

In a multi-pattern rule, it's more useful to give a source line
of a respective pattern.

Consider this example:

         //line1: m.Match(
         //line2:        `foo()`,
         //line3:        `bar()`,
         //line4: )

Previously, if either `foo()` or `bar()` would match, we would
have a matchInfo rule line set to `line1`, since it's a
rule definition line (`Match` expression location).

Now we'll have a rule line set to `line1` if `foo()` matches,
otherwise `line2` if `bar()` matches. This is useful during
both debugging and rules usage.
@quasilyte quasilyte merged commit bdf083c into master Oct 12, 2021
@quasilyte quasilyte deleted the quasilyte/associate_rule_line_with_pattern_string branch October 12, 2021 08:31
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

Successfully merging this pull request may close these issues.

None yet

1 participant