From 62f532533805e225f408721cfbd3c20a267397e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 21:39:22 +0000 Subject: [PATCH] Address code review feedback - Add version component validation in versions.sh - Add verbose mode to validate_all.sh for debugging - Update documentation with verbose mode usage - Improve error messages with hints to use verbose mode Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- scripts/README.md | 6 +++-- scripts/fix/versions.sh | 20 ++++++++++------ scripts/run/validate_all.sh | 47 +++++++++++++++++++++++++++++-------- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 69be32f..41a1edc 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -225,10 +225,12 @@ Runs all validation scripts and provides a comprehensive report: - Executes all optional validation checks - Provides colored output with pass/fail indicators - Returns summary with counts +- Supports verbose mode for detailed output Usage: ```bash -./scripts/run/validate_all.sh +./scripts/run/validate_all.sh # Standard mode +./scripts/run/validate_all.sh -v # Verbose mode (shows all output) ``` Example output: @@ -243,7 +245,7 @@ INFO: Running all validation checks... === Optional Checks === [SUCCESS] ✓ no_secrets [SUCCESS] ✓ php_syntax -WARN: ✗ tabs (warnings/issues found) +WARN: ✗ tabs (warnings/issues found - run with -v for details) === Validation Summary === Required checks passed: 2/2 diff --git a/scripts/fix/versions.sh b/scripts/fix/versions.sh index 581536c..491bf3c 100755 --- a/scripts/fix/versions.sh +++ b/scripts/fix/versions.sh @@ -132,13 +132,19 @@ fi # Update README.md version references if [ -f "README.md" ]; then -# Look for version references in format VERSION: XX.XX.XX -if grep -q 'VERSION: [0-9]' README.md; then -# Convert to zero-padded format if needed -PADDED_VERSION="$(printf '%s' "${VERSION}" | awk -F. '{printf "%02d.%02d.%02d", $1, $2, $3}')" -sed_inplace "s|VERSION: [0-9]{2}\.[0-9]{2}\.[0-9]{2}|VERSION: ${PADDED_VERSION}|g" README.md -log_info "✓ Updated README.md version references" -fi + # Look for version references in format VERSION: XX.XX.XX + if grep -q 'VERSION: [0-9]' README.md; then + # Validate version format has 3 components + component_count=$(echo "${VERSION}" | awk -F. '{print NF}') + if [ "${component_count}" -eq 3 ]; then + # Convert to zero-padded format + PADDED_VERSION="$(printf '%s' "${VERSION}" | awk -F. '{printf "%02d.%02d.%02d", $1, $2, $3}')" + sed_inplace "s|VERSION: [0-9]{2}\.[0-9]{2}\.[0-9]{2}|VERSION: ${PADDED_VERSION}|g" README.md + log_info "✓ Updated README.md version references" + else + log_warn "Version format invalid for padding, skipping README.md update" + fi + fi fi log_info "=========================================" diff --git a/scripts/run/validate_all.sh b/scripts/run/validate_all.sh index d121c9b..515cd6f 100755 --- a/scripts/run/validate_all.sh +++ b/scripts/run/validate_all.sh @@ -43,6 +43,13 @@ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)" # Configuration # ---------------------------------------------------------------------------- +VERBOSE="${1:-}" +if [ "${VERBOSE}" = "-v" ] || [ "${VERBOSE}" = "--verbose" ]; then + VERBOSE="true" +else + VERBOSE="false" +fi + REQUIRED_CHECKS=( "manifest" "xml_wellformed" @@ -83,12 +90,22 @@ for check in "${REQUIRED_CHECKS[@]}"; do fi log_step "Running: ${check}" - if "${script}" >/dev/null 2>&1; then - log_success "✓ ${check}" - required_passed=$((required_passed + 1)) + if [ "${VERBOSE}" = "true" ]; then + if "${script}"; then + log_success "✓ ${check}" + required_passed=$((required_passed + 1)) + else + log_error "✗ ${check} (FAILED)" + required_failed=$((required_failed + 1)) + fi else - log_error "✗ ${check} (FAILED)" - required_failed=$((required_failed + 1)) + if "${script}" >/dev/null 2>&1; then + log_success "✓ ${check}" + required_passed=$((required_passed + 1)) + else + log_error "✗ ${check} (FAILED - run with -v for details)" + required_failed=$((required_failed + 1)) + fi fi done @@ -104,12 +121,22 @@ for check in "${OPTIONAL_CHECKS[@]}"; do fi log_step "Running: ${check}" - if "${script}" >/dev/null 2>&1; then - log_success "✓ ${check}" - optional_passed=$((optional_passed + 1)) + if [ "${VERBOSE}" = "true" ]; then + if "${script}"; then + log_success "✓ ${check}" + optional_passed=$((optional_passed + 1)) + else + log_warn "✗ ${check} (warnings/issues found)" + optional_failed=$((optional_failed + 1)) + fi else - log_warn "✗ ${check} (warnings/issues found)" - optional_failed=$((optional_failed + 1)) + if "${script}" >/dev/null 2>&1; then + log_success "✓ ${check}" + optional_passed=$((optional_passed + 1)) + else + log_warn "✗ ${check} (warnings/issues found - run with -v for details)" + optional_failed=$((optional_failed + 1)) + fi fi done