-
Notifications
You must be signed in to change notification settings - Fork 35
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
Let policy flag accept directories. #284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM. Thank you for this contribution. I made a few suggestions. Before merging, could you also update the comment on lines 35-36 in src/registry/check.rs with the following text: ‘List policy files or directories containing policy files to verify against the semantic convention registry.’ There are other sub-commands like generate, resolve, etc., where you should also make this change. Thanks.
crates/weaver_checker/src/lib.rs
Outdated
assert_eq!(1, engine.policy_package_count); | ||
|
||
_ = engine.add_policy_from_file_or_dir("data/multi-policies")?; | ||
// TODO: add_policies double counts the number of files it adds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, there is double counting in add_policies. It would be good to take advantage of this PR to fix the bug. Thank you.
Co-authored-by: Laurent Quérel <[email protected]>
Updated policy flag documentation.
fixes #259
This change allows --policy flags to accept a directory and include any *.rego file found. It does not recurse into sub directories.