mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-11 16:38:20 +00:00
Pass svg_checks.sh via ShellCheck
while read svgfile; do SC2162: read without -r will mangle backslashes. if [ $(wc -c < "$svgfile") -gt $(wc -c < "$outfile") ]; SC2046: quote to prevent word splitting found increment was done in a subshell and hence would not be properly incremented. Instead of: find | while Switch to: while < <( find ) Based on https://github.com/koalaman/shellcheck/wiki/SC2031 , this way $found is kept in the same context. Change-Id: Id8eb1027eed373161c8e7932b7745d4f53f2fc6c
This commit is contained in:
parent
97552204f6
commit
a38b4f8038
|
@ -1,16 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
found=0
|
||||
|
||||
find resources -type f -name '*.svg' |
|
||||
while read svgfile; do
|
||||
while read -r svgfile; do
|
||||
outfile="$svgfile.tmp"
|
||||
node_modules/.bin/svgo --config .svgo.yml -i "$svgfile" -o "$outfile" -q
|
||||
if [ $(wc -c < "$svgfile") -gt $(wc -c < "$outfile") ]; then
|
||||
if [ "$(wc -c < "$svgfile")" -gt "$(wc -c < "$outfile")" ]; then
|
||||
echo "File $svgfile is not compressed."
|
||||
found=$((found + 1))
|
||||
fi
|
||||
rm "$outfile"
|
||||
done
|
||||
done < <(find resources -type f -name '*.svg')
|
||||
|
||||
if [ $found -gt 0 ]; then
|
||||
echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch."
|
||||
|
|
Loading…
Reference in a new issue