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

chore(general): Add a job to ensure evaluated keys are added to new resource checks #6958

Merged
merged 5 commits into from
Jan 22, 2025

Conversation

tsmithv11
Copy link
Collaborator

@tsmithv11 tsmithv11 commented Jan 17, 2025

User description

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Added an action job to ensure evaluated keys are added to new or modified python checks

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

Generated description

Below is a concise technical summary of the changes proposed in this PR:

Adds a new GitHub Actions job to validate that new or modified Python checks include evaluated keys. Implements the get_evaluated_keys() method in the AzureMLWorkspacePrivateEndpoint check class to return the list of evaluated keys.

TopicDetails
Eval Keys Validation Adds a new GitHub Actions job to ensure new or modified Python checks include evaluated keys
Modified files (1)
  • .github/workflows/pr-test.yml
Latest Contributors(2)
UserCommitDate
omriyoffe-panwfeat-serverless-Server...December 04, 2024
lirshindalmanfix-general-pipenv-202...October 30, 2024
Check Update Implements get_evaluated_keys() method in AzureMLWorkspacePrivateEndpoint class
Modified files (1)
  • checkov/arm/checks/resource/AzureMLWorkspacePrivateEndpoint.py
Latest Contributors(2)
UserCommitDate
tsmithv11fix-terraform-Fix-reso...July 25, 2024
taviassaffeat-azure-add-new-pol...July 11, 2024
This pull request is reviewed by Baz. Join @tsmithv11 and the rest of your team on (Baz).

@tsmithv11
Copy link
Collaborator Author

Here's an example of it failing and now in this PR you can see it passing.

Caught


# Only run checks if not in exceptions list
if [[ "$SKIP_FILE" == "false" ]]; then
# If file contains 'BaseResourceCheck', check for 'get_inspected_key' or 'evaluated_keys'
Copy link
Contributor

Choose a reason for hiding this comment

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

this is only a partial validation, as BaseResourceCheck doesn't exist in all of the code.
for example, if we inherited from it a class called BaseCloudformationResourceCheck, any check which inerits from this one will not catch this.
I don't mind adding this check for now, but a better solution would be a python linter (flake8-plugin for example) which can catch this issue

@tsmithv11 tsmithv11 merged commit 07b694b into main Jan 22, 2025
35 of 36 checks passed
@tsmithv11 tsmithv11 deleted the eval-keys-gha-check branch January 22, 2025 06:10
Saarett pushed a commit that referenced this pull request Jan 22, 2025
…esource checks (#6958)

* Add action and example

* fix

* Fix lint and test case

* fix lint
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.

3 participants