(lint) Anchor command start more strictly to avoid false positives.

This commit is contained in:
Ville Skyttä 2010-05-11 00:47:52 +03:00
parent 5022808775
commit 783acae98c

View File

@ -14,26 +14,28 @@ gitgrep()
unset CDPATH
cd $(dirname "$0") ; cd ..
gitgrep "\bawk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \
cmdstart='(^|[[:space:]]|\()'
gitgrep $cmdstart"awk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \
'awk with -F char or -F ERE, use -Fchar instead (Solaris)'
gitgrep "\bawk\b.*\[:[a-z]*:\]" \
gitgrep $cmdstart"awk\b.*\[:[a-z]*:\]" \
'awk with POSIX character class not supported in mawk (Debian/Ubuntu)'
gitgrep '\bsed\b.*\\[?+]' \
gitgrep $cmdstart'sed\b.*\\[?+]' \
'sed with ? or +, use POSIX BRE instead (\{m,n\})'
gitgrep '\bsed\b.*\\\|' \
gitgrep $cmdstart'sed\b.*\\\|' \
"sed with \|, use POSIX BRE (possibly multiple sed invocations) or another tool instead"
# TODO: really nonportable? appears to work fine in Linux, FreeBSD, Solaris
#gitgrep '\bsed\b.*;' \
#gitgrep $cmdstart'sed\b.*;' \
# 'sed with ;, use multiple -e options instead (POSIX?) (false positives?)'
gitgrep '\bsed\b.*-[^[:space:]]*[rE]' \
gitgrep $cmdstart'sed\b.*-[^[:space:]]*[rE]' \
'sed with -r or -E, drop and use POSIX BRE instead'
gitgrep '\b[ef]grep\b' \
gitgrep $cmdstart'[ef]grep\b' \
'[ef]grep, use grep -[EF] instead (historical/deprecated)'
# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in