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

feat: add glob matching configuration #4

Merged
merged 3 commits into from
Nov 28, 2023
Merged

feat: add glob matching configuration #4

merged 3 commits into from
Nov 28, 2023

Conversation

spiffcs
Copy link
Collaborator

@spiffcs spiffcs commented Nov 27, 2023

Summary

Grant can now be configured using glob syntax to match on deny or allow policy rule sets

deny: *
allow:
  - MIT
  - Apache-*

In the above case all licenses are denied. MIT is then allowed along with all permutations of Apache-*. This would include:

Apache-1.0
Apache License 1.1
Apache License 2.0

Report Generator

Also included is a refactor/roadmap for multiple source configuration. Grant as a library has been updated to generate a Report which contains a Result for each provided source. Library users can use:

report := NewReport(format, policy, srcs...)

This allows a custom policy to be provided/configured for multiple sources.

To run the policy against each source users can execute:

report.Run()

Because Run returns the populated report users can then call Render(io.Writer) to write the results. The format is considered at the time of construction, but the format can be changed after the fact.

report.Run().Render(io.Writer)

@spiffcs spiffcs marked this pull request as ready for review November 28, 2023 18:33
@spiffcs spiffcs merged commit be0c829 into main Nov 28, 2023
2 checks passed
@spiffcs spiffcs deleted the glob-match branch November 28, 2023 18:34
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.

1 participant