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

refactor: refactor interface of base check #513

Merged
merged 7 commits into from
Nov 3, 2023
Merged

Conversation

nicallen
Copy link
Member

Refactor BaseCheck.run_check to return all result info as part of return value, rather than passing in and mutating a CheckResult object containing other data irrelevant to run_check.
Refactor SLSA requirement status information in AnalyzeContext to avoid unnecessary replication of generic info about a SLSA requirement, which can be looked up by ReqName when needed instead.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 13, 2023
@nathanwn
Copy link
Member

You probably need to regenerate the API doc with make docs-api when the PR is finalized.

src/macaron/slsa_analyzer/checks/check_result.py Outdated Show resolved Hide resolved
@@ -176,14 +176,14 @@ def get_slsa_level_table(self) -> SLSALevel:

def get_dict(self) -> dict:
"""Return the dictionary representation of the AnalyzeContext instance."""
_sorted_on_id = sorted(self.check_results.values(), key=lambda item: item["check_id"])
_sorted_on_id = sorted(self.check_results.values(), key=lambda item: item.check.check_id)
# Remove result_tables since we don't have a good json representation for them.
sorted_on_id = []
for res in _sorted_on_id:
# res is CheckResult(TypedDict)
Copy link
Member

Choose a reason for hiding this comment

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

This comment should be adjusted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@behnazh-w
Copy link
Member

behnazh-w commented Oct 20, 2023

@nicallen It would be good to add a Developer Docs page to describe the check interface. We already have a README.md though to help contributors add a new check. To avoid duplication, we can move the content of the README.md to the RST page and add a link to the README.md?

@behnazh-w
Copy link
Member

@nicallen I think it makes sense to change the commit scope to refactor so that it gets added to the release changelog.

@behnazh-w
Copy link
Member

You probably need to regenerate the API doc with make docs-api when the PR is finalized.

Sounds good. @nicallen please rebase on staging to include the latest docs updates.

Refactor BaseCheck.run_check to return all result info as part of return
value, rather than passing in and mutating a CheckResult object
containing other data irrelevant to run_check.
Refactor SLSA requirement status information in AnalyzeContext to avoid
unnecessary replication of generic info about a SLSA requirement, which
can be looked up by ReqName when needed instead.

Signed-off-by: Nicholas Allen <[email protected]>
Signed-off-by: Nicholas Allen <[email protected]>
@nicallen nicallen force-pushed the refactor-base-check branch from 831955a to a28940d Compare October 31, 2023 05:01
@nicallen nicallen changed the title chore: refactor interface of base check refactor: refactor interface of base check Oct 31, 2023
@nicallen
Copy link
Member Author

@nicallen It would be good to add a Developer Docs page to describe the check interface. We already have a README.md though to help contributors add a new check. To avoid duplication, we can move the content of the README.md to the RST page and add a link to the README.md?

I have created an separate issue for this (#535), I don't think we need to do this immediately as part of this PR.

@nicallen nicallen force-pushed the refactor-base-check branch from a28940d to 9a61b7c Compare October 31, 2023 05:22
@nicallen nicallen merged commit 118cad3 into staging Nov 3, 2023
10 checks passed
@nicallen nicallen deleted the refactor-base-check branch November 3, 2023 00:23
art1f1c3R pushed a commit that referenced this pull request Nov 29, 2024
Refactor BaseCheck.run_check to return all result info as part of return
value, rather than passing in and mutating a CheckResult object
containing other data irrelevant to run_check.
Refactor SLSA requirement status information in AnalyzeContext to avoid
unnecessary replication of generic info about a SLSA requirement, which
can be looked up by ReqName when needed instead.

Signed-off-by: Nicholas Allen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants