-
Notifications
You must be signed in to change notification settings - Fork 671
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
Add sorted results to srg_diff #9778
Add sorted results to srg_diff #9778
Conversation
Also some minor refactoring
utils/srg_diff.py
Outdated
@@ -116,15 +119,36 @@ def get_requirements_with_no_cces(sheet: Worksheet, end_row: int) -> list: | |||
return result | |||
|
|||
|
|||
def get_deltas(cac_cce_dict, cce_rule_id_dict, common_set, disa_cce_dict): |
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.
Can this function also have type parameters?
|
||
title = f"{base_path} vs {target_path}" | ||
|
||
template = _create_template(args.root) | ||
missing_in_base.sort() | ||
missing_in_target.sort() | ||
deltas.sort() |
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 got this traceback:
[jcerny@thinkpad scap-security-guide{pr/9778}]$ python3 utils/srg_diff.py --target "/home/jcerny/Downloads/RHEL 9 STIG Stage 3 Submission_2022_11_01.xlsx" --base cac_export.xlsx --product rhel9 --output diff.html
/usr/lib/python3.10/site-packages/openpyxl/worksheet/_reader.py:300: UserWarning: Unknown extension is not supported and will be removed
warn(msg)
Traceback (most recent call last):
File "/home/jcerny/work/git/scap-security-guide/utils/srg_diff.py", line 193, in <module>
main()
File "/home/jcerny/work/git/scap-security-guide/utils/srg_diff.py", line 178, in main
deltas.sort()
TypeError: '<' not supported between instances of 'SrgDiffResult' and 'SrgDiffResult'
[jcerny@thinkpad scap-security-guide{pr/9778}]$
Can you take a look into it?
Code Climate has analyzed commit 64fc5bb and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 46.8% (0.0% change). View more on Code Climate. |
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.
LGTM.
I have generated the diff using python3 utils/srg_diff.py --target "/home/jcerny/Downloads/RHEL 9 STIG Stage 3 Submission_2022_11_01.xlsx" --base cac_export.xlsx --product rhel9 --output diff.html
and I have opened it and I can see that the output is expected. I don't experience the aforementioned traceback anymore.
The CI fail on Fedora rawhide is in OpenSCAP and isn't related to this PR.
Description:
utils/srg_diff.py
sortedutils/srg_diff.py
Rationale:
Review Hints: