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

Sanitize lines for clean YAML output when generating profiles #10870

Conversation

rhmdnd
Copy link
Collaborator

@rhmdnd rhmdnd commented Jul 18, 2023

There is an issue with how pyyaml dumps lines, where if the line ends
with whitespace, styling won't matter.

yaml/pyyaml#121

This was affecting our ability to generate YAML output where audit
procedures (with many long lines) would get rendered as a single line
with escaped newlines. Instead, we want to render newlines as a block.

This commit parse each line of the data before it is dumped to make sure
trailing whitespace is removed as a workaround for this issue in pyyaml.

@github-actions
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

@Mab879 Mab879 self-assigned this Jul 18, 2023
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Can you please fix the PEP8 issue here?

utils/generate_profile.py Show resolved Hide resolved
There is an issue with how pyyaml dumps lines, where if the line ends
with whitespace, styling won't matter.

  yaml/pyyaml#121

This was affecting our ability to generate YAML output where audit
procedures (with many long lines) would get rendered as a single line
with escaped newlines. Instead, we want to render newlines as a block.

This commit parse each line of the data before it is dumped to make sure
trailing whitespace is removed as a workaround for this issue in pyyaml.
@rhmdnd rhmdnd force-pushed the sanitize-yaml-lines-for-generate-profile-script branch from 55d3ce6 to 58922f0 Compare July 21, 2023 12:55
@Mab879 Mab879 added this to the 0.1.70 milestone Jul 21, 2023
@Mab879 Mab879 added the Infrastructure Our content build system label Jul 21, 2023
@codeclimate
Copy link

codeclimate bot commented Jul 21, 2023

Code Climate has analyzed commit 58922f0 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 53.2% (0.0% change).

View more on Code Climate.

@Mab879
Copy link
Member

Mab879 commented Jul 21, 2023

/packit retest-failed

@Mab879
Copy link
Member

Mab879 commented Jul 21, 2023

/packit rebuild-failed

@Mab879 Mab879 merged commit a96ccb9 into ComplianceAsCode:master Jul 21, 2023
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants