33# This script handles some basic QA checks on the source
44
55NOPOST=$1
6- LIBRARY_NAME=` hatch project metadata name`
7- LIBRARY_VERSION=` hatch version | awk -F " ." ' {print $1"."$2"."$3}' `
8- POST_VERSION=` hatch version | awk -F " ." ' {print substr($4,0,length($4))}' `
6+ LIBRARY_NAME=$( hatch project metadata name)
7+ LIBRARY_VERSION=$( hatch version | awk -F " ." ' {print $1"."$2"."$3}' )
8+ POST_VERSION=$( hatch version | awk -F " ." ' {print substr($4,0,length($4))}' )
99TERM=${TERM:= " xterm-256color" }
1010
1111success () {
@@ -29,7 +29,7 @@ while [[ $# -gt 0 ]]; do
2929 ;;
3030 * )
3131 if [[ $1 == -* ]]; then
32- printf " Unrecognised option: $1 \n " ;
32+ printf " Unrecognised option: %s\n " " $1 " ;
3333 exit 1
3434 fi
3535 POSITIONAL_ARGS+=(" $1 " )
4040inform " Checking $LIBRARY_NAME $LIBRARY_VERSION \n"
4141
4242inform " Checking for trailing whitespace..."
43- grep -IUrn --color " [[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
44- if [[ $? -eq 0 ]]; then
43+ if grep -IUrn --color " [[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO; then
4544 warning " Trailing whitespace found!"
4645 exit 1
4746else
5049printf " \n"
5150
5251inform " Checking for DOS line-endings..."
53- grep -lIUrn --color $' \r ' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
54- if [[ $? -eq 0 ]]; then
52+ if grep -lIUrn --color $' \r ' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile; then
5553 warning " DOS line-endings found!"
5654 exit 1
5755else
6058printf " \n"
6159
6260inform " Checking CHANGELOG.md..."
63- cat CHANGELOG.md | grep ^${LIBRARY_VERSION} > /dev/null 2>&1
64- if [[ $? -eq 1 ]]; then
61+ if ! grep " ^${LIBRARY_VERSION} " CHANGELOG.md > /dev/null 2>&1 ; then
6562 warning " Changes missing for version ${LIBRARY_VERSION} ! Please update CHANGELOG.md."
6663 exit 1
6764else
7067printf " \n"
7168
7269inform " Checking for git tag ${LIBRARY_VERSION} ..."
73- git tag -l | grep -E " ${LIBRARY_VERSION} $"
74- if [[ $? -eq 1 ]]; then
70+ if ! git tag -l | grep -E " ${LIBRARY_VERSION} $" ; then
7571 warning " Missing git tag for version ${LIBRARY_VERSION} "
7672fi
7773printf " \n"
0 commit comments