Detect which directories to test
This commit is contained in:
parent
174533479a
commit
904aa4a20d
@ -26,13 +26,51 @@
|
|||||||
|
|
||||||
#variables
|
#variables
|
||||||
PROGNAME="shlint.sh"
|
PROGNAME="shlint.sh"
|
||||||
|
PROJECTCONF="../project.conf"
|
||||||
#executables
|
#executables
|
||||||
|
DATE="date"
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
FIND="find"
|
FIND="find"
|
||||||
SHLINT="sh -n"
|
SHLINT="sh -n"
|
||||||
|
TR="tr"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
#shlint
|
||||||
|
_shlint()
|
||||||
|
{
|
||||||
|
ret=0
|
||||||
|
subdirs="data doc src tests tools"
|
||||||
|
|
||||||
|
$DATE
|
||||||
|
echo
|
||||||
|
while read line; do
|
||||||
|
case "$line" in
|
||||||
|
"["*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"subdirs="*)
|
||||||
|
subdirs=${line#subdirs=}
|
||||||
|
subdirs=$(echo "$subdirs" | $TR ',' ' ')
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < "$PROJECTCONF"
|
||||||
|
for subdir in $subdirs; do
|
||||||
|
[ -d "../$subdir" ] || continue
|
||||||
|
for filename in $($FIND "../$subdir" -name '*.sh'); do
|
||||||
|
$DEBUG $SHLINT "$filename" 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$filename:"
|
||||||
|
else
|
||||||
|
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||||
|
ret=2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
_debug()
|
_debug()
|
||||||
{
|
{
|
||||||
@ -79,9 +117,5 @@ target="$1"
|
|||||||
#clean
|
#clean
|
||||||
[ $clean -ne 0 ] && return 0
|
[ $clean -ne 0 ] && return 0
|
||||||
|
|
||||||
ret=0
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
for i in $($FIND "../doc" "../src" "../tests" "../tools" -name '*.sh'); do
|
_shlint > "$target"
|
||||||
$DEBUG $SHLINT "$i" || ret=2
|
|
||||||
done 2> "$target"
|
|
||||||
exit $ret
|
|
||||||
|
Loading…
Reference in New Issue
Block a user