|
| 1 | +# WP Code Check - Frequently Asked Questions |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +## Why should I care about this Code Check Tool? |
| 6 | + |
| 7 | +**Because WordPress sites crash in production from issues that slip through code review.** These aren't syntax errors — they're performance antipatterns that work perfectly in development but explode at scale: |
| 8 | + |
| 9 | +- A `posts_per_page => -1` query works fine with 10 posts, but crashes the server when your client has 50,000 posts |
| 10 | +- N+1 query patterns that turn 1 request into 1,000 database calls |
| 11 | +- Missing capability checks that let subscribers delete your entire site |
| 12 | +- Debug code (`var_dump`, `console.log`) that exposes sensitive data to users |
| 13 | + |
| 14 | +**WP Code Check catches these issues in seconds** — before they cause downtime, security breaches, or angry 3 AM support calls. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## What does this catch that PHP Lint and PHP CS don't catch? |
| 19 | + |
| 20 | +| Issue Type | PHP Lint | PHPCS/WPCS | WP Code Check | |
| 21 | +|------------|----------|------------|---------------| |
| 22 | +| **Unbounded queries** (`posts_per_page => -1`) | ❌ | ❌ | ✅ | |
| 23 | +| **N+1 patterns** (queries in loops) | ❌ | ❌ | ✅ | |
| 24 | +| **Missing capability checks** | ❌ | ⚠️ Partial | ✅ | |
| 25 | +| **AJAX without nonce validation** | ❌ | ⚠️ Partial | ✅ | |
| 26 | +| **Insecure deserialization** | ❌ | ❌ | ✅ | |
| 27 | +| **Debug code in production** | ❌ | ⚠️ Partial | ✅ | |
| 28 | +| **SQL without LIMIT** | ❌ | ❌ | ✅ | |
| 29 | +| **file_get_contents() with URLs** | ❌ | ❌ | ✅ | |
| 30 | +| **Syntax errors** | ✅ | ✅ | ❌ | |
| 31 | +| **Coding standards** | ❌ | ✅ | ❌ | |
| 32 | + |
| 33 | +**Bottom line:** PHP Lint catches broken code. PHPCS catches ugly code. WP Code Check catches **dangerous** code that will crash your production site. |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## How fast can I install it? |
| 38 | + |
| 39 | +**About 30 seconds:** |
| 40 | + |
| 41 | +```bash |
| 42 | +# Clone the repo |
| 43 | +git clone https://github.com/YOUR_ORG/wp-code-check.git |
| 44 | + |
| 45 | +# Run it |
| 46 | +./wp-code-check/dist/bin/check-performance.sh --paths /your/plugin |
| 47 | +``` |
| 48 | + |
| 49 | +That's it. No Composer. No PHP extensions. No configuration files. It's just Bash + grep, so it runs anywhere. |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Can I use this in my CI/CD pipeline? |
| 54 | + |
| 55 | +**Absolutely. That's the primary use case.** WP Code Check is designed for automated CI/CD integration: |
| 56 | + |
| 57 | +```yaml |
| 58 | +# GitHub Actions example |
| 59 | +- name: Run WP Code Check |
| 60 | + run: | |
| 61 | + git clone https://github.com/YOUR_ORG/wp-code-check.git |
| 62 | + ./wp-code-check/dist/bin/check-performance.sh --paths . --format json |
| 63 | +``` |
| 64 | +
|
| 65 | +**Key CI/CD features:** |
| 66 | +- **JSON output** (`--format json`) for machine parsing |
| 67 | +- **Exit codes** — returns non-zero on errors for pipeline failure |
| 68 | +- **Strict mode** (`--strict`) — fail on warnings too |
| 69 | +- **Baseline support** — only flag new issues in legacy codebases |
| 70 | +- **Fast execution** — scans 10,000 files in under 5 seconds |
| 71 | + |
| 72 | +Works with GitHub Actions, GitLab CI, Bitbucket Pipelines, Jenkins, CircleCI, and any other CI system. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## What if I have a legacy codebase with hundreds of existing issues? |
| 77 | + |
| 78 | +**Use the baseline feature.** It lets you "snapshot" your current state and only flag **new** issues going forward: |
| 79 | + |
| 80 | +```bash |
| 81 | +# Step 1: Generate baseline from current state |
| 82 | +./dist/bin/check-performance.sh --paths . --generate-baseline |
| 83 | +
|
| 84 | +# Step 2: Future scans only report NEW issues |
| 85 | +./dist/bin/check-performance.sh --paths . |
| 86 | +``` |
| 87 | + |
| 88 | +This is perfect for: |
| 89 | +- Legacy projects you inherited |
| 90 | +- Large plugins/themes where fixing everything at once isn't practical |
| 91 | +- Teams that want to prevent regression without a massive refactor |
| 92 | + |
| 93 | +The baseline file (`.neochrome-baseline`) is human-readable and can be committed to version control. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +*Have more questions? Open an issue on [GitHub](https://github.com/YOUR_ORG/wp-code-check/issues).* |
| 98 | + |
0 commit comments