-
Notifications
You must be signed in to change notification settings - Fork 696
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
Tool for identifying the most used rules #11439
Tool for identifying the most used rules #11439
Conversation
Skipping CI for Draft Pull Request. |
@Honny1 It would be great to sort the output by the count of the rules. |
e92662f
to
343816e
Compare
@jan-cerny The rules are listed in descending order. |
343816e
to
c04dde4
Compare
@Honny1 It doesn't sort for me |
c04dde4
to
c411eee
Compare
@jan-cerny Fixed! |
now it sorts for me, thanks |
a07c06e
to
5f02cea
Compare
@marcusburghardt Yes, the changes from #11438 should be incorporated into this PR. I will rebase on the master after merging #11438. |
e9e7849
to
d915f63
Compare
2d19ce6
to
cf9e5c4
Compare
cf9e5c4
to
146d801
Compare
60b5992
to
0761fe4
Compare
/packit build |
0761fe4
to
75bb8dc
Compare
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.
I have tested all the functions and they are working as expected. I have only some minor comments mainly about readability. After that I believe it would be good to be merged.
|
||
|
||
class Profile: | ||
def __init__(self, path, title): |
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.
Have you considered to also count the variables? I think it is easy to extend and this information might be useful as well.
If so, the next function can also be renamed from add_rule
to add_rule_or_var
, for example. However, it would be probably better to extend this in another PR.
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.
Yes, it can easily be expanded if necessary.
75bb8dc
to
c5a9444
Compare
🤖 A k8s content image for this PR is available at: Click here to see how to deploy itIf you alread have Compliance Operator deployed: Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and: |
Add optional benchmark parameters. Without parameters, the control files from the project will be used.
7b536c5
to
2d96df9
Compare
2d96df9
to
44fcfa0
Compare
44fcfa0
to
18bfd53
Compare
Code Climate has analyzed commit 18bfd53 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 83.3% (50% is the threshold). This pull request will bring the total coverage in the repository to 59.8% (2.0% change). View more on Code Climate. |
/packit retest-failed |
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.
Nice work @Honny1 . This capability will open space for good insights. Thanks
Description:
This PR adds a subcommand
profile_tool.py
that generates a list of rules with the number of uses in profiles in different formats.Rationale:
It is known that many rules are common among profiles so we can infer that much less than 1825 rules are in fact used for RHEL, but we are including thousands of rules in the data stream because we don't know exactly what is needed or not.
We have many rules without Ansible remediation, some rules without Bash remediation and some few rules without OVAL check. It is great to close the gaps, but it would be smart to prioritize the most used rules.
It is hard to identify these most used rules and consequently optimize our efforts.
Review Hints:
To generate a list of the most used rules in the
rhel9
benchmark you can run this command:Or you can run this command to get info about the whole project:
Depends on: #11438