(lint) Anchor command start more strictly to avoid false positives.
This commit is contained in:
parent
5022808775
commit
783acae98c
16
test/runLint
16
test/runLint
@ -14,26 +14,28 @@ gitgrep()
|
|||||||
unset CDPATH
|
unset CDPATH
|
||||||
cd $(dirname "$0") ; cd ..
|
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)'
|
'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)'
|
'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\})'
|
'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"
|
"sed with \|, use POSIX BRE (possibly multiple sed invocations) or another tool instead"
|
||||||
|
|
||||||
# TODO: really nonportable? appears to work fine in Linux, FreeBSD, Solaris
|
# 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?)'
|
# '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'
|
'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)'
|
'[ef]grep, use grep -[EF] instead (historical/deprecated)'
|
||||||
|
|
||||||
# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in
|
# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user