mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-22 14:23:53 -07:00
cleanup
This commit is contained in:
parent
f0a2e688c4
commit
597f8c96cc
4 changed files with 26 additions and 25 deletions
15
nextnumber
15
nextnumber
|
@ -1,13 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# TODO: Find a less trashy way to get the next available error code
|
# TODO: Find a less trashy way to get the next available error code
|
||||||
if ! shopt -s globstar
|
if ! shopt -s globstar; then
|
||||||
then
|
|
||||||
echo "Error: This script depends on Bash 4." >&2
|
echo "Error: This script depends on Bash 4." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in 1 2
|
for i in 1 2; do
|
||||||
do
|
last=$(grep --no-filename --invert-match "^prop" ./**/*.hs \
|
||||||
last=$(grep -hv "^prop" ./**/*.hs | grep -Ewo "$i[0-9]{3}" | sort -n | tail -n 1)
|
| grep --extended-regexp --word-regexp --only-matching "$i[0-9]{3}" \
|
||||||
|
| sort --numeric-sort \
|
||||||
|
| tail --lines 1
|
||||||
|
)
|
||||||
echo "Next ${i}xxx: $((last+1))"
|
echo "Next ${i}xxx: $((last+1))"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
4
quickrun
4
quickrun
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# quickrun runs ShellCheck in an interpreted mode.
|
# quickrun runs ShellCheck in an interpreted mode.
|
||||||
# This allows testing changes without recompiling.
|
# This allows testing changes without recompiling.
|
||||||
|
|
||||||
runghc -isrc -idist/build/autogen shellcheck.hs "$@"
|
runghc -isrc -idist/build/autogen shellcheck.hs "$@"
|
||||||
|
|
||||||
|
exit
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# quicktest runs the ShellCheck unit tests in an interpreted mode.
|
# quicktest runs the ShellCheck unit tests in an interpreted mode.
|
||||||
# This allows running tests without compiling, which can be faster.
|
# This allows running tests without compiling, which can be faster.
|
||||||
# 'cabal test' remains the source of truth.
|
# 'cabal test' remains the source of truth.
|
||||||
|
@ -16,7 +16,7 @@ if [[ $var == *$'\nTrue'* ]]
|
||||||
then
|
then
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
grep -C 3 -e "Fail" -e "Tracing" <<< "$var"
|
grep --context 3 --regexp "Fail" --regexp "Tracing" <<< "${var}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
) 2>&1
|
) 2>&1
|
||||||
|
|
28
striptests
28
striptests
|
@ -5,15 +5,14 @@
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
sponge() {
|
sponge() {
|
||||||
data="$(cat)"
|
local -r DATA="$(cat)"
|
||||||
printf '%s\n' "$data" > "$1"
|
printf '%s\n' "${DATA}" > "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
modify() {
|
modify() {
|
||||||
if ! "${@:2}" < "$1" | sponge "$1"
|
if ! "${@:2}" < "${1}" | sponge "${1}"
|
||||||
then
|
|
||||||
{
|
{
|
||||||
printf 'Failed to modify %s: ' "$1"
|
printf 'Failed to modify %s: ' "${1}"
|
||||||
printf '%q ' "${@:2}"
|
printf '%q ' "${@:2}"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
} >&2
|
} >&2
|
||||||
|
@ -50,28 +49,23 @@ detestify() {
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ ! -e 'ShellCheck.cabal' ]]; then
|
||||||
|
|
||||||
if [[ ! -e ShellCheck.cabal ]]
|
|
||||||
then
|
|
||||||
echo "Run me from the ShellCheck directory." >&2
|
echo "Run me from the ShellCheck directory." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d '.git' ]] && ! git diff --exit-code > /dev/null 2>&1
|
if [[ -d '.git' ]] && ! git diff --exit-code > /dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "You have local changes! These may be overwritten." >&2
|
echo "You have local changes! These may be overwritten." >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
modify ShellCheck.cabal sed -e '
|
modify 'ShellCheck.cabal' sed -e '
|
||||||
/QuickCheck/d
|
/QuickCheck/d
|
||||||
/^test-suite/{ s/.*//; q; }
|
/^test-suite/{ s/.*//; q; }
|
||||||
'
|
'
|
||||||
|
|
||||||
find . -name '.git' -prune -o -type f -name '*.hs' -print |
|
while IFS= read -r file; do
|
||||||
while IFS= read -r file
|
modify "${file}" detestify
|
||||||
do
|
done < <(find . -name '.git' -prune -o -type f -name '*.hs' -print)
|
||||||
modify "$file" detestify
|
|
||||||
done
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue