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

Asterisk (*) added at end of ignore pattern, bug? #26

Open
mikaello opened this issue Mar 13, 2024 · 0 comments · May be fixed by #28
Open

Asterisk (*) added at end of ignore pattern, bug? #26

mikaello opened this issue Mar 13, 2024 · 0 comments · May be fixed by #28

Comments

@mikaello
Copy link

When defining an ignore pattern, e.g. FILE_TRAILING_NEWLINE_IGNORE=".git,*.svg,*.excalidraw", the resulting path will get an * added at the end. Example:

`find . -type f -not \( -path "./.git*" -o -path "./*.svg*" -o -path "./*.excalidraw*" \) ! -size 0 -print0 | xargs -0 -P 8 -n1 grep -Il '' | tr '\n' '\0' | xargs -0 -P 8 -n1 sh -c 'if [ -f "${1}" ]; then aci-trailing-newline -n "$1" || echo "$1: No trailing newline at EOF."; fi' --`

This seems like a bug, this makes it impossible to only match files with certain extensions without also matching files having that extension in the middle of the file name, e.g. somefile.excalidraw.custom_ending will also be ignored.

It seems like this is the code responsible:

#
# 'find' pattern for ignores/excludes
#
if [ "${MY_IGN}" != "" ]; then
EXCL_PATTERN="-not \( -path \"${MY_PATH}/${MY_IGN//,/*\" -o -path \"${MY_PATH}\/}*\" \)"
else
EXCL_PATTERN=""
fi

would it be possible to not add an asterisk at the end?

mikaello added a commit to mikaello/docker-file-lint that referenced this issue Mar 18, 2024
@mikaello mikaello linked a pull request Mar 18, 2024 that will close this issue
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 a pull request may close this issue.

1 participant