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