diff --git a/tools/toolkit-qa-check.sh b/tools/toolkit-qa-check.sh index 94209d3..3b9e05e 100755 --- a/tools/toolkit-qa-check.sh +++ b/tools/toolkit-qa-check.sh @@ -904,7 +904,7 @@ echo "" #============================================================================== # CHECK 31: local keyword outside functions (CRITICAL - script fails) #============================================================================== -echo "[31/31] Checking: 'local' outside functions..." +echo "[31/32] Checking: 'local' outside functions..." { echo "## CHECK 31: 'local' keyword outside function context" echo "Severity: CRITICAL" @@ -954,6 +954,63 @@ done < <(find "$TOOLKIT_PATH" -name "*.sh" -type f 2>/dev/null) echo "" } >> "$REPORT" +#============================================================================== +# CHECK 32: Menu standards compliance (LOW - UX consistency) +#============================================================================== +echo "[32/32] Checking: Menu standards compliance..." +{ +echo "## CHECK 32: Menu standards compliance" +echo "Severity: LOW" +echo "Issue: Menus should follow standard format for consistent UX" +echo "" + +# Check for menus with inconsistent back buttons +while IFS=: read -r file line_num line_content; do + # Look for menu functions (show_*_menu) + if echo "$line_content" | grep -qE 'show_.*_menu\(\)|handle_.*_menu\(\)'; then + menu_file="$file" + + # Check if this file has proper back button (within next 100 lines) + has_back=0 + line_count=0 + while IFS= read -r check_line && [ "$line_count" -lt 100 ]; do + if echo "$check_line" | grep -qE '\$\{RED\}0\)\$\{NC\}.*(Back to Main Menu|Exit)'; then + has_back=1 + break + fi + line_count=$((line_count + 1)) + done < <(tail -n +$line_num "$file") + + if [ "$has_back" -eq 0 ]; then + echo "LOW|$file|$line_num|Menu missing standard back button (RED 0)" + count_issue "LOW" + fi + fi +done < <(grep -rn 'show_.*_menu()\|handle_.*_menu()' "$TOOLKIT_PATH" --include="*.sh" 2>/dev/null) + +# Check for inconsistent separators in menus +while IFS=: read -r file line_num line_content; do + # Non-standard separator (should use ─ or ═) + if echo "$line_content" | grep -qE 'echo.*"[-]{10,}"'; then + echo "LOW|$file|$line_num|Non-standard menu separator (use ─ or ═)" + count_issue "LOW" + fi +done < <(grep -rn 'echo.*"[-]\{10,\}"' "$TOOLKIT_PATH" --include="*.sh" --exclude="toolkit-qa-check.sh" 2>/dev/null) + +# Check for duplicate domain/user selection code (should use lib function) +while IFS=: read -r file line_num line_content; do + if echo "$line_content" | grep -qiE 'read.*-p.*"Enter domain|read -p.*domain.*:'; then + # Check if this file sources domain-selector.sh + if ! grep -q 'source.*domain-selector.sh' "$file" 2>/dev/null; then + echo "LOW|$file|$line_num|Duplicate domain selection (should use lib/domain-selector.sh)" + count_issue "LOW" + fi + fi +done < <(grep -rin 'read.*-p.*domain' "$TOOLKIT_PATH/modules" --include="*.sh" 2>/dev/null) + +echo "" +} >> "$REPORT" + #============================================================================== # PERFORMANCE CHECKS (INFO level - not counted as issues) #==============================================================================