Files
Linux-Server-Management-Too…/tools
cschantz a19ad8ca3d Add logic validation checks (CHECK 89-94) to QA script
Extended toolkit-qa-check.sh with 6 new logic validation checks to detect
semantic/behavioral errors that syntactic checks alone cannot catch:

- CHECK 89 (CRITICAL): Inverted/contradictory grep patterns
  Detects: grep -v X | grep X (always returns empty, logic error)

- CHECK 90 (HIGH): Type mismatch in comparisons
  Detects: Numeric operators on string variables ([ $var -lt 80 ] where var='75.23%')

- CHECK 91 (HIGH): Command argument ordering errors
  Detects: Filename before options in grep/sed (grep FILE -e PATTERN)

- CHECK 92 (HIGH): Missing command availability checks
  Detects: Uses of optional commands (nc, dig, host, jq) without 'command -v' checks

- CHECK 93 (HIGH): Uninitialized variables in AWK
  Detects: AWK variables set in patterns without BEGIN initialization

- CHECK 94 (HIGH): Undefined variable references
  Detects: Variables that appear undefined or typos in variable names

Also added helper functions for logic analysis:
- detect_grep_contradiction() - detects contradictory patterns
- infer_numeric_context() - determines if variable should be numeric
- check_awk_var_init() - checks AWK variable initialization
- get_function_vars() - extracts defined variables from functions

These checks complement the existing 88 checks by focusing on logic errors
that would pass syntax validation but cause runtime bugs.

Progress counter updated from /88 to /94 (6 new checks added).
Added qa-suppress annotations to prevent false positives in the QA script itself.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-07 01:04:24 -05:00
..