Fix DEP check false positives for detect_control_panel

detect_control_panel is in system-detect.sh, not domain-discovery.sh
Check now properly validates that system-detect.sh is sourced
This commit is contained in:
cschantz
2026-01-09 18:09:18 -05:00
parent 4ab211fd26
commit b61d16dc7e
+27 -9
View File
@@ -1845,17 +1845,35 @@ while IFS=: read -r file line_num line_content; do
if [[ "$func_used" =~ (print_|confirm_action) ]]; then
required_lib="common-functions.sh"
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
echo " Risk: Function undefined error at runtime"
echo " Fix: Add 'source \$(dirname \$0)/../lib/$required_lib' at top of script"
count_issue "HIGH"
((count++))
[ "$count" -ge 10 ] && break
fi
elif [[ "$func_used" =~ detect_control_panel ]]; then
# detect_control_panel is in system-detect.sh
if ! grep -q "source.*system-detect\.sh" "$file" 2>/dev/null; then
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing system-detect.sh"
echo " Risk: Function undefined error at runtime"
echo " Fix: Add 'source \$(dirname \$0)/../lib/system-detect.sh' at top of script"
count_issue "HIGH"
((count++))
[ "$count" -ge 10 ] && break
fi
else
# Domain/user functions are in domain-discovery.sh
required_lib="domain-discovery.sh"
fi
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
echo " Risk: Function undefined error at runtime"
echo " Fix: Add 'source \$(dirname \$0)/../lib/$required_lib' at top of script"
count_issue "HIGH"
((count++))
[ "$count" -ge 10 ] && break
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
echo " Risk: Function undefined error at runtime"
echo " Fix: Add 'source \$(dirname \$0)/../lib/$required_lib' at top of script"
count_issue "HIGH"
((count++))
[ "$count" -ge 10 ] && break
fi
fi
done < <(grep -rnE "\b($common_funcs|$detect_funcs)\b" "$TOOLKIT_PATH" --include="*.sh" --exclude="common-functions.sh" --exclude="domain-discovery.sh" --exclude="system-detect.sh" 2>/dev/null | head -100)