sk- / git-lint

improving source code one step at a time
Apache License 2.0
237 stars 78 forks source link

Fix optipng-linter.sh to handle multiple pngs #129

Open siebert opened 6 years ago

siebert commented 6 years ago

Also clean up the script and make it pass shellcheck.

siebert commented 6 years ago

I have no idea why Travis CI complains about formatting in python files when only a shell file is changed by this commit. Seems to me an error in the CI configuration.

sk- commented 6 years ago

@siebert I don't see how this PR is handling multiple images. Note though that instead of using that simplistic script a much better alternative would be to use https://github.com/sk-/optimage.

Thanks for pointing the problem with the Python formatting, the reason is because I didn't pin the yapf version in the requirements.

siebert commented 6 years ago

The actual fix is this line:

OUTFILE="$(mktemp)"

Using a fixed tempfile name didn't work for me for patches which contains multiple pngs. Apparently the script is run in parallel, so the same tempfile is rewritten/removed by other instances when tried to read by the current instance which then fails.