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

test-outside-test-package: functions prefixed test_ aren't tests #177

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

anderseknert
Copy link
Member

Fixes #176

Fixes #176

Signed-off-by: Anders Eknert <anders@styra.com>
@@ -20,6 +20,7 @@ package_name := concat(".", [path.value |

tests := [rule |
some rule in input.rules
not rule.head.args
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this warrant a comment to say that this is saying if not function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess I've become a little blind to these things by now 😄 Perhaps even better to add a is_function(rule) helper to ast.rego? I can do so in a follow-up PR.

Copy link
Member

@srenatus srenatus Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 Or even a helper?

is_function(rule) if rule.head.args

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that works better!

@anderseknert anderseknert merged commit ebc5059 into main Jun 27, 2023
@anderseknert anderseknert deleted the false-positive-test-outside-test-package branch June 27, 2023 08:17
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.

False positive for test-outside-test-package when function named test_*
3 participants