aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/commitcheck.sh
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-01-17 10:17:16 -0800
committerGitHub <[email protected]>2018-01-17 10:17:16 -0800
commit3da3488e6339ff2dc5c7f3da8c8a0c552d018d68 (patch)
treeacf9843a79221a7fa9de852507d3cdef8772ee44 /scripts/commitcheck.sh
parentd658b2caa95726c13d99123874910cdedc7ce866 (diff)
Fix shellcheck v0.4.6 warnings
Resolve new warnings reported after upgrading to shellcheck version 0.4.6. This patch contains no functional changes. * egrep is non-standard and deprecated. Use grep -E instead. [SC2196] * Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. [SC2181] Suppressed. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #7040
Diffstat (limited to 'scripts/commitcheck.sh')
-rwxr-xr-xscripts/commitcheck.sh19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/commitcheck.sh b/scripts/commitcheck.sh
index 927f5e737..190943916 100755
--- a/scripts/commitcheck.sh
+++ b/scripts/commitcheck.sh
@@ -19,7 +19,7 @@ function test_url()
function test_commit_bodylength()
{
length="72"
- body=$(git log -n 1 --pretty=%b "$REF" | egrep -m 1 ".{$((length + 1))}")
+ body=$(git log -n 1 --pretty=%b "$REF" | grep -E -m 1 ".{$((length + 1))}")
if [ -n "$body" ]; then
echo "error: commit message body contains line over ${length} characters"
return 1
@@ -32,7 +32,7 @@ function test_commit_bodylength()
function check_tagged_line()
{
regex='^\s*'"$1"':\s[[:print:]]+\s<[[:graph:]]+>$'
- foundline=$(git log -n 1 "$REF" | egrep -m 1 "$regex")
+ foundline=$(git log -n 1 "$REF" | grep -E -m 1 "$regex")
if [ -z "$foundline" ]; then
echo "error: missing \"$1\""
return 1
@@ -69,7 +69,7 @@ function new_change_commit()
error=0
# subject is not longer than 50 characters
- long_subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '.{51}')
+ long_subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{51}')
if [ -n "$long_subject" ]; then
echo "error: commit subject over 50 characters"
error=1
@@ -91,7 +91,7 @@ function new_change_commit()
function is_openzfs_port()
{
# subject starts with OpenZFS means it's an openzfs port
- subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS')
+ subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^OpenZFS')
if [ -n "$subject" ]; then
return 0
fi
@@ -104,7 +104,7 @@ function openzfs_port_commit()
error=0
# subject starts with OpenZFS dddd
- subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS [[:digit:]]+(, [[:digit:]]+)* - ')
+ subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^OpenZFS [[:digit:]]+(, [[:digit:]]+)* - ')
if [ -z "$subject" ]; then
echo "error: OpenZFS patch ports must have a subject line that starts with \"OpenZFS dddd - \""
error=1
@@ -146,7 +146,7 @@ function openzfs_port_commit()
function is_coverity_fix()
{
# subject starts with Fix coverity defects means it's a coverity fix
- subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^Fix coverity defects')
+ subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^Fix coverity defects')
if [ -n "$subject" ]; then
return 0
fi
@@ -160,7 +160,7 @@ function coverity_fix_commit()
# subject starts with Fix coverity defects: CID dddd, dddd...
subject=$(git log -n 1 --pretty=%s "$REF" |
- egrep -m 1 'Fix coverity defects: CID [[:digit:]]+(, [[:digit:]]+)*')
+ grep -E -m 1 'Fix coverity defects: CID [[:digit:]]+(, [[:digit:]]+)*')
if [ -z "$subject" ]; then
echo "error: Coverity defect fixes must have a subject line that starts with \"Fix coverity defects: CID dddd\""
error=1
@@ -174,8 +174,9 @@ function coverity_fix_commit()
# test each summary line for the proper format
OLDIFS=$IFS
IFS=$'\n'
- for line in $(git log -n 1 --pretty=%b "$REF" | egrep '^CID'); do
- echo "$line" | egrep '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)' > /dev/null
+ for line in $(git log -n 1 --pretty=%b "$REF" | grep -E '^CID'); do
+ echo "$line" | grep -E '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)' > /dev/null
+ # shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "error: commit message has an improperly formatted CID defect line"
error=1