devtools: fix letter case check in commit title

The prefix (before the colon) of the title is lowercase.
The check of uppercase/lowercase in the commit title
was supposed to apply after the colon,
but some greps were not limited to the exact word.
So in the case of "test/dma: add basic dmadev instance tests",
the lowercase word "dmadev" was wrongly suggested to be uppercase.

The words of the dictionary must be filtered as whole word
with the grep option -w.

Fixes: d448efa259 ("devtools: export dictionary for commit title check")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
Thomas Monjalon 2021-10-18 11:55:58 +02:00
parent db7f9ec2f1
commit 8b51fbc09e

View File

@ -111,12 +111,12 @@ IFS='
'
words="$selfdir/words-case.txt"
for word in $(cat $words); do
bad=$(echo "$headlines" | grep -iw $word | grep -v $word)
bad=$(echo "$headlines" | grep -iw $word | grep -vw $word)
if [ "$word" = "Tx" ]; then
bad=$(echo $bad | grep -v 'OCTEON\ TX')
fi
for bad_line in $bad; do
bad_word=$(echo $bad_line | cut -d":" -f2 | grep -io $word)
bad_word=$(echo $bad_line | cut -d":" -f2 | grep -iwo $word)
[ -z "$bad_word" ] || { printf "Wrong headline case:\n\
\"$bad_line\": $bad_word --> $word\n" && failure=true;}
done