Skip to content

Commit 9d54532

Browse files
evallespopenshift-merge-bot[bot]
authored andcommitted
Adding a custom entry for trailling-whitespace
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>
1 parent b983d9a commit 9d54532

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ repos:
55
hooks:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
8+
entry: bash -c 'affected_files=(); for f in "$@"; do grep -l "[[:space:]]$" "$f" 2>/dev/null && affected_files+=("$f"); done; if [ ${#affected_files[@]} -gt 0 ]; then trailing-whitespace-fixer "${affected_files[@]}"; exit $?; else exit 0; fi' --
89
- id: mixed-line-ending
910
- id: check-byte-order-marker
1011
- id: check-executables-have-shebangs

0 commit comments

Comments
 (0)