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

Fix Policies Cloning #3971

Merged
merged 5 commits into from
Apr 15, 2024
Merged

Fix Policies Cloning #3971

merged 5 commits into from
Apr 15, 2024

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Apr 10, 2024

1. Explain what the PR does

6185bdc chore: improve Clone tests by using google/go-cmp
2273675 chore(filters): add ValueHandler function type
02e4a12 chore(policy): add inner methods for iteration
392535a fix(policy): iterate array to preserve order
239087a fix(policy): Policies Clone method

2273675 chore(filters): add ValueHandler function type

It is a function type that can be used to handle the value of a filter
when it is parsed.

This also removes a dead code.

02e4a12 chore(policy): add inner methods for iteration

Depending o the use case, the iteration of the policies can be done
by allFromArray() or allFromMap().

392535a fix(policy): iterate array to preserve order

To fill userlandPolicies, we need to iterate over the array of policies
to preserve the order, since the map iteration order is not guaranteed.

239087a fix(policy): Policies Clone method

Use Set instead of Add to preserve the order of the policies.

This also removes the unnecessary call to compute() method as it is
already called by the Set inners.

2. Explain how to test it

3. Other comments

@geyslan geyslan force-pushed the fix-policies-clone branch from 6c03a52 to e69964c Compare April 11, 2024 18:30
@rscampos rscampos marked this pull request as draft April 12, 2024 16:42
geyslan added 3 commits April 12, 2024 17:37
Use Set instead of Add to preserve the order of the policies.

This also removes the unnecessary call to compute() method as it is
already called by the Set inners.
To fill userlandPolicies, we need to iterate over the array of policies
to preserve the order, since the map iteration order is not guaranteed.
Depending o the use case, the iteration of the policies can be done
by allFromArray() or allFromMap().
geyslan added 2 commits April 12, 2024 17:48
It is a function type that can be used to handle the value of a filter
when it is parsed.

This also removes a dead code.
@geyslan geyslan force-pushed the fix-policies-clone branch from 9f2085f to 6185bdc Compare April 12, 2024 20:50
@geyslan geyslan changed the title fix(policy): Policies Clone method fix(policy): Policies Cloning Apr 12, 2024
@geyslan geyslan changed the title fix(policy): Policies Cloning Fix Policies Cloning Apr 12, 2024
@geyslan geyslan marked this pull request as ready for review April 12, 2024 20:51
Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

LGTM

@geyslan geyslan merged commit 90475e0 into aquasecurity:main Apr 15, 2024
32 checks passed
@geyslan geyslan deleted the fix-policies-clone branch June 28, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants