Skip to content

Adding a custom entry for trailling-whitespace#3812

Open
evallesp wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
evallesp:add-trailing-whitespace-custom-entry
Open

Adding a custom entry for trailling-whitespace#3812
evallesp wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
evallesp:add-trailing-whitespace-custom-entry

Conversation

@evallesp
Copy link
Copy Markdown
Contributor

We're adding a wrapper around trailing-whitespace-fixer, which is the default entry https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml#L205

So now, instead of directly call it, we are checking if is there any space in the files, if so, then we add it to the list and we call trailing-whitespace-fixer. if not file, then we don't execute anything and we retrieve success.

Apart of impacting positive as we're not calling by default the trailing-whitespace-fixer python script, now we can see the files that needs to remove the whitespace.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 30, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fultonj for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@evallesp evallesp force-pushed the add-trailing-whitespace-custom-entry branch 2 times, most recently from 6807750 to d553d39 Compare March 30, 2026 11:51
@evallesp
Copy link
Copy Markdown
Contributor Author

Output of previous patch version where we got some trailling whitespaces:

[INFO] This may take a few minutes...
fix end of files.........................................................Passed
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

create-infra.yml
Fixing create-infra.yml
scripts/create_role_molecule.py
Fixing scripts/create_role_molecule.py
roles/update_containers/defaults/main.yml
Fixing roles/update_containers/defaults/main.yml

We're adding a wrapper around trailing-whitespace-fixer, which is the
default entry https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml#L205

So now, instead of directly call it, we are checking if is there any space
in the files, if so, then we add it to the list and we call trailing-whitespace-fixer.
if not file, then we don't execute anything and we retrieve success.

Apart of impacting positive as we're not calling by default the trailing-whitespace-fixer python script,
now we can see the files that needs to remove the whitespace.

Signed-off-by: Enrique Vallespi Gil <evallesp@redhat.com>
@evallesp evallesp force-pushed the add-trailing-whitespace-custom-entry branch from d553d39 to 5911238 Compare March 30, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant