diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93ce7d1..15a4783 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,11 +123,26 @@ jobs: validate-test-fixtures: name: Validate Test Fixtures runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout code uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Environment snapshot + run: | + echo "=== CI Environment Diagnostic ===" + echo "OS: $(uname -a)" + echo "Shell: $SHELL ($BASH_VERSION)" + echo "jq: $(command -v jq && jq --version || echo 'NOT INSTALLED')" + echo "perl: $(perl -v | head -2)" + echo "grep: $(grep --version | head -1)" + echo "=================================" + - name: Make scripts executable run: | chmod +x ./dist/bin/check-performance.sh @@ -136,7 +151,7 @@ jobs: - name: Run automated fixture tests run: | echo "Running automated fixture validation..." - ./dist/tests/run-fixture-tests.sh + cd dist && ./tests/run-fixture-tests.sh - name: Test antipatterns detection (legacy check) run: | diff --git a/.github/workflows/example-caller.yml b/.github/workflows/example-caller.yml deleted file mode 100644 index 3aa6caf..0000000 --- a/.github/workflows/example-caller.yml +++ /dev/null @@ -1,80 +0,0 @@ -# Example: How to call the reusable WP Performance workflow from your plugin -# Version: 1.0.1 -# -# β οΈ THIS IS AN EXAMPLE/TEMPLATE FILE - NOT AN ACTIVE WORKFLOW -# -# This file is for DOCUMENTATION purposes only. -# Copy this file to your plugin's .github/workflows/ directory and customize. -# Rename to something like "ci.yml" or "performance.yml" -# -# DO NOT activate this workflow in the wp-code-check repository itself! -# The active workflow for this repo is ci.yml - -name: CI - Performance Checks (EXAMPLE - DO NOT USE) - -# TRIGGERS DISABLED - This is a template file that will never run automatically -# When using in your own plugin, replace the 'on:' section below with real triggers -on: - workflow_dispatch: # Only manual trigger - prevents automatic runs - inputs: - note: - description: 'This is a template file. Copy to your plugin repo to use.' - required: false - default: 'See README for usage instructions' - -# EXAMPLE TRIGGERS (uncomment and customize when using in your plugin): -# -# on: -# push: -# branches: [main, development] -# pull_request: -# branches: [main] - -jobs: - # Option 1: Call the reusable workflow from the central repo - # Uncomment and update the repository reference when published - # - # performance: - # uses: neochrome/automated-wp-code-testing/.github/workflows/wp-performance.yml@main - # with: - # paths: 'includes/ src/' - # php-version: '8.2' - # fail-on-warning: false - - # Option 2: Run checks directly (for standalone use) - performance-standalone: - name: Performance Checks (Standalone) - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Run Performance Checks - run: | - # Run the local check script if available - if [ -f "./bin/check-performance.sh" ]; then - chmod +x ./bin/check-performance.sh - ./bin/check-performance.sh --paths "." --strict - else - echo "No local check script found. Running inline checks..." - - # Inline grep checks (same as reusable workflow) - FAILED=0 - - echo "π Checking for unbounded queries..." - if grep -rn --include="*.php" --exclude-dir=vendor --exclude-dir=node_modules \ - -e "posts_per_page[[:space:]]*=>[[:space:]]*-1" \ - -e "numberposts[[:space:]]*=>[[:space:]]*-1" \ - -e "nopaging[[:space:]]*=>[[:space:]]*true" .; then - echo "::error::Found unbounded query patterns!" - FAILED=1 - fi - - if [ "$FAILED" = "1" ]; then - exit 1 - fi - - echo "β All checks passed!" - fi - diff --git a/.gitignore b/.gitignore index e1d6535..5dae01a 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,12 @@ dist/tests/irl/* !dist/tests/irl/_AI_AUDIT_INSTRUCTIONS.md !dist/tests/irl/.gitkeep +# Auto-generated pattern library files (regenerated on every scan) +# These files are auto-generated by pattern-library-manager.sh +# and change with every scan due to timestamp updates +dist/PATTERN-LIBRARY.json +dist/PATTERN-LIBRARY.md + # ============================================ # DEVELOPMENT & TESTING # ============================================ diff --git a/CHANGELOG.md b/CHANGELOG.md index 363ee06..047f0b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,169 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.2.4] - 2026-01-12 + +### Added +- **Phase 1 Improvements: Enhanced False Positive Filtering** + - **Improved `is_line_in_comment()` function** (now in shared library) + - Added string literal detection to ignore `/* */` inside quotes + - Increased backscan window from 50 to 100 lines (catches larger docblocks) + - Added inline comment detection for same-line `/* comment */` patterns + - Filters out string content before counting comment markers + - **Improved `is_html_or_rest_config()` function** (now in shared library) + - Tightened HTML form pattern: `