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

controleval.py: Return empty list when parameter is not found #11300

Conversation

yuumasato
Copy link
Member

Description:

  • This changes the function to return an empty list when the section is not found.
    It could also return None, but the expected return type is list.

Rationale:

  • get_parameter_from_yaml() doesn't handle KeyErrors.
  • After Add alternatives to mandatory keys #11268, profiles with no selections are known to be extending another profile, let's not count the control usage multiple times and consider selections as empty.

Review Hints:

`get_parameter_from_yaml()` doesn't handle KeyErrors.
This changes the function to return an empty list when the section is
not found.

It could also return `None`, but the expected return type is list.

Profiles with no `selections` are extending another profile,
let's not count the control usage multiple times.
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

codeclimate bot commented Nov 22, 2023

Code Climate has analyzed commit 6c6bed7 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 58.5%.

View more on Code Climate.

@marcusburghardt marcusburghardt self-assigned this Nov 23, 2023
@marcusburghardt marcusburghardt added this to the 0.1.71 milestone Nov 23, 2023
Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@marcusburghardt marcusburghardt added enhancement General enhancements to the project. usability Enhancements related to usability. and removed enhancement General enhancements to the project. labels Nov 23, 2023
@marcusburghardt marcusburghardt merged commit aae83e9 into ComplianceAsCode:master Nov 23, 2023
38 checks passed
@yuumasato yuumasato deleted the controleval_metrics_on_no_selection_profiles branch November 23, 2023 10:17
@Mab879 Mab879 added the Infrastructure Our content build system label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system usability Enhancements related to usability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants