diff --git a/scripts/review-loop-run b/scripts/review-loop-run index 205d8d1..52b6fb7 100755 --- a/scripts/review-loop-run +++ b/scripts/review-loop-run @@ -60,10 +60,10 @@ _counts_scope() { # _is_declaration_line → 0 (true) iff the line is a declaration-only # line. After stripping `*` emphasis markers, the line must consist solely of # declaration tokens (CRITICAL/HIGH/MEDIUM/LOW, any severity) separated by -# [.,;\s]+, with nothing else except label-style parentheticals matching -# [A-Z][0-9]+ (e.g. "(C1)" labelling the count) which are stripped before the -# check. Non-label parentheticals (finding IDs like "(H-R3-1)", annotations -# like "(see §3.2)", trailing prose after the count) disqualify the line. +# [.,;\s]+, with nothing else except short label parentheticals matching +# [A-Z][0-9]+ (e.g. "(C1)"), which are stripped first (CR-8 label +# exception). Any other parenthetical or trailing prose (finding IDs +# like "(H-R3-1)", "(see §3.2)") disqualifies the line. _is_declaration_line() { local line="$1" # Strip `*` emphasis markers @@ -73,8 +73,8 @@ _is_declaration_line() { reduced=$(printf '%s\n' "$clean" | sed -E 's/(CRITICAL|HIGH|MEDIUM|LOW)[[:space:]]*[:=][[:space:]]*[0-9]+/__TOK__/g') reduced=$(printf '%s\n' "$reduced" | sed -E 's/(CRITICAL|HIGH|MEDIUM|LOW)[[:space:]]*\([0-9]+\)/__TOK__/g') reduced=$(printf '%s\n' "$reduced" | sed -E 's/[0-9]+[[:space:]]+(CRITICAL|HIGH|MEDIUM|LOW)/__TOK__/g') - # Strip label-style parentheticals (single uppercase letter + digits) - reduced=$(printf '%s\n' "$reduced" | sed -E 's/[[:space:]]*\([A-Z][0-9]+\)//g') + # Strip short label parentheticals (single uppercase letter + digits) + reduced=$(printf '%s\n' "$reduced" | sed -E 's/[[:space:]]*\(([A-Z][0-9]+)\)//g') # Remaining must be only separators + __TOK__s. # Use a variable for the pattern to keep bash from mis-parsing the # embedded `;` and `[[:space:]]` inside `[[ =~ ]]`. @@ -135,7 +135,6 @@ _counts_extract() { counts() { local f="$1" [[ -f "$f" ]] || die "result file not found: $f" 2 - shopt -s nocasematch local scope; scope=$(_counts_scope "$f") local -A vals=() local sev found_any=0 @@ -163,7 +162,6 @@ counts() { fi fi fi - shopt -u nocasematch local out="" total=0 for sev in CRITICAL HIGH MEDIUM LOW; do