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 function name ignore filter for argument-always-wildcard #923

Closed
nevumx opened this issue Jul 17, 2024 · 0 comments · Fixed by #924
Closed

Add function name ignore filter for argument-always-wildcard #923

nevumx opened this issue Jul 17, 2024 · 0 comments · Fixed by #924

Comments

@nevumx
Copy link

nevumx commented Jul 17, 2024

So, regarding https://docs.styra.com/regal/rules/bugs/argument-always-wildcard, (and constant-condition) I can see the rationale, but this is actually a common pattern for mocking functions for unit tests like so:

mock_failure_two_args(_, _) if {
	false # regal ignore:constant-condition <-- This rule too
}

# elsewhere...

test_some_func_fails if {
	not allow with input as some_input with some_two_arg_func as mock_failure_two_args
}

Pretty simple to ignore, but also could use an ignore pattern for function names.

See https://styracommunity.slack.com/archives/C05HF2KRY3G/p1721235767450349?thread_ts=1721235252.149699&cid=C05HF2KRY3G

anderseknert added a commit that referenced this issue Jul 17, 2024
And have functions starting with "mock_" excepted by default.

Fixes #923

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit that referenced this issue Jul 17, 2024
And have functions starting with "mock_" excepted by default.

Fixes #923

Signed-off-by: Anders Eknert <anders@styra.com>
charlieegan3 pushed a commit that referenced this issue Jul 18, 2024
And have functions starting with "mock_" excepted by default.

Fixes #923

Signed-off-by: Anders Eknert <anders@styra.com>
charlieegan3 pushed a commit that referenced this issue Jul 18, 2024
…d` (#924)

And have functions starting with "mock_" excepted by default.

Fixes #923

Signed-off-by: Anders Eknert <anders@styra.com>
srenatus pushed a commit to srenatus/regal that referenced this issue Oct 1, 2024
…d` (StyraInc#924)

And have functions starting with "mock_" excepted by default.

Fixes StyraInc#923

Signed-off-by: Anders Eknert <anders@styra.com>
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 a pull request may close this issue.

1 participant