Avoid matching regular expressions from the script

This commit is contained in:
Pierre Pronchery 2020-11-04 18:29:40 +01:00
parent 4825b61558
commit dac8310839

View File

@ -27,6 +27,8 @@
#variables #variables
PROGNAME="fixme.sh" PROGNAME="fixme.sh"
PROJECTCONF="../project.conf" PROJECTCONF="../project.conf"
REGEXP_ERROR="FIXME"
REGEXP_WARNING="\\(TODO\|XXX\\)"
#executables #executables
DATE="date" DATE="date"
DEBUG="_debug" DEBUG="_debug"
@ -99,9 +101,9 @@ _fixme_asm()
filename="$1" filename="$1"
#warnings #warnings
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename" $GREP -nH "/\\*.*$REGEXP_WARNING" "$filename"
#failures #failures
$GREP -nH '/\*.*FIXME' "$filename" && res=2 $GREP -nH "/\\*.*$REGEXP_ERROR" "$filename" && res=2
return $res return $res
} }
@ -111,9 +113,9 @@ _fixme_c()
filename="$1" filename="$1"
#warnings #warnings
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename" $GREP -nH "/\\(/\\|\\*\\).*$REGEXP_WARNING" "$filename"
#failures #failures
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && res=2 $GREP -nH "/\\(/\\|\\*\\).*$REGEXP_ERROR" "$filename" && res=2
return $res return $res
} }
@ -121,13 +123,12 @@ _fixme_sh()
{ {
res=0 res=0
filename="$1" filename="$1"
#XXX avoid matching the regexp
comment="#" comment="#"
#warnings #warnings
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename" $GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
#failures #failures
$GREP -nH "$comment.*FIXME" "$filename" && res=2 $GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
return $res return $res
} }
@ -138,9 +139,9 @@ _fixme_xml()
#XXX limited to a single line #XXX limited to a single line
#warnings #warnings
$GREP -nH '<!--.*\(TODO\|XXX\)' "$filename" $GREP -nH "<!--.*$REGEXP_WARNING" "$filename"
#failures #failures
$GREP -nH '<!--.*FIXME' "$filename" && res=2 $GREP -nH "<!--.*$REGEXP_ERROR" "$filename" && res=2
return $res return $res
} }