Skip to content

Commit

Permalink
Add some apostrophes to suppress some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vlajos committed Sep 16, 2018
1 parent 8497810 commit a01756e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dockered-fixer
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

docker run -ti --rm -v $(pwd):/work vlajos/misspell-fixer "$@"
docker run -ti --rm -v "$(pwd):/work" vlajos/misspell-fixer "$@"
30 changes: 15 additions & 15 deletions misspell-fixer
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function prepare_prefilter_input_from_cat {
while read -r filename
do
printf '%s\0' "$filename"
done <$1
done <"$1"
}

function prefilter_progress_none {
Expand All @@ -257,24 +257,24 @@ function main_work {

$input_function $prev_matched_files|\
tee >($prefilter_progress_function) \
>(xargs -0 $cmd_part_parallelism -n 100 grep --text -F -noH -f $tmpfile.prep.grep.rules >$itertmpfile.combos)|\
xargs -0 $cmd_part_parallelism -n 100 grep --text -F -noH -w -f $tmpfile.prep.grep.rules.w >$itertmpfile.combos.w
>(xargs -0 $cmd_part_parallelism -n 100 grep --text -F -noH -f "$tmpfile.prep.grep.rules" >"$itertmpfile.combos")|\
xargs -0 $cmd_part_parallelism -n 100 grep --text -F -noH -w -f "$tmpfile.prep.grep.rules.w" >"$itertmpfile.combos.w"

sort -u $itertmpfile.combos $itertmpfile.combos.w >$itertmpfile.combos.all
sort -u "$itertmpfile.combos" "$itertmpfile.combos.w" >"$itertmpfile.combos.all"

if [[ $opt_verbose = 1 ]]
then
verbose "Results of prefiltering: (filename:line:pattern)"
cat $itertmpfile.combos.all >&2
cat "$itertmpfile.combos.all" >&2
fi

if [[ -s $itertmpfile.combos.all ]]
then
grep --text -f <(cut -d ':' -f 3 $itertmpfile.combos.all) $tmpfile.prep.allsedrules >$itertmpfile.rulesmatched
grep --text -f <(cut -d ':' -f 3 "$itertmpfile.combos.all") "$tmpfile.prep.allsedrules" >"$itertmpfile.rulesmatched"
warning "Iteration $iteration: replacing."
cut -d ':' -f 1 $itertmpfile.combos.all |sort -u >$itertmpfile.matchedfiles
xargs <$itertmpfile.matchedfiles $cmd_part_parallelism -n 1 -I '{}' $COVERAGE_WRAPPER bash -c$bash_arg "$loop_function $itertmpfile.combos.all $itertmpfile.rulesmatched '{}' 1"
rm $itertmpfile.rulesmatched
cut -d ':' -f 1 "$itertmpfile.combos.all" |sort -u >"$itertmpfile.matchedfiles"
xargs <"$itertmpfile.matchedfiles" $cmd_part_parallelism -n 1 -I '{}' $COVERAGE_WRAPPER bash -c$bash_arg "$loop_function $itertmpfile.combos.all $itertmpfile.rulesmatched '{}' 1"
rm "$itertmpfile.rulesmatched"
if [[ $opt_dots = 1 ]]
then
echo >&2
Expand All @@ -283,20 +283,20 @@ function main_work {
warning "Iteration $iteration: nothing to replace."
fi
warning "Iteration $iteration: done."
if [[ $iteration -lt 5 && -s $itertmpfile.combos.all ]]
if [[ $iteration -lt 5 && -s "$itertmpfile.combos.all" ]]
then
if diff --text -q $prev_matches $itertmpfile.combos.all >/dev/null
if diff --text -q "$prev_matches" "$itertmpfile.combos.all" >/dev/null
then
warning "Iteration $iteration: matchlist is the same as in previous iteration..."
else
main_work prepare_prefilter_input_from_cat $((iteration + 1)) $itertmpfile.matchedfiles $itertmpfile.combos.all
main_work prepare_prefilter_input_from_cat $((iteration + 1)) "$itertmpfile.matchedfiles" "$itertmpfile.combos.all"
fi
fi
if [[ -f $itertmpfile.matchedfiles ]]
then
rm $itertmpfile.matchedfiles
rm "$itertmpfile.matchedfiles"
fi
rm $itertmpfile.combos $itertmpfile.combos.w $itertmpfile.combos.all
rm "$itertmpfile.combos" "$itertmpfile.combos.w" "$itertmpfile.combos.all"
return 0
}

Expand Down Expand Up @@ -330,7 +330,7 @@ function loop_main_replace {

"${sed[@]}" -f <(
IFS=$'\n'
for patternwithline in $(grep --text "$filename" $findresult|cut -d ':' -f 2,3)
for patternwithline in $(grep --text "$filename" "$findresult"|cut -d ':' -f 2,3)
do
line=${patternwithline/:*/}
pattern=${patternwithline/*:/}
Expand Down

0 comments on commit a01756e

Please sign in to comment.