Skip to content

Improve theme file scanning accuracy - #500

Merged
obenland merged 2 commits into
masterfrom
fix/file-scanning-accuracy
Sep 1, 2026
Merged

obenland merged 2 commits into
masterfrom
fix/file-scanning-accuracy

Conversation

@obenland

@obenland obenland commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

A couple of accuracy improvements to how themes are scanned.

PHP file collection. File-type routing keyed only on a lowercase, final .php suffix, so names like functions.PHP or functions.php.bak were treated as "other" files and skipped the PHP checks. A new tc_is_php_file() helper matches any PHP extension component case-insensitively, so those files are scanned like plain .php files.

Child themes. The presence-based checks (base template functions, required files, title-tag support) assume a standalone theme, so a child theme scanned on its own reports failures for pieces its parent supplies. A new tc_is_child_theme() helper lets those checks skip only the parent-provided requirements — Basic_Check, index.php in File_Check, and Theme_Support_Title_Tag_Check — while child themes still have to meet their own requirements (screenshot, readme, style.css headers) and are still scanned for disallowed code.

Testing

  • phpcs clean against the repo standard.
  • Verified in a disposable WordPress (Playground) that a complete child theme passes, an incomplete one still fails on its own requirements, and disallowed code in a child theme is still flagged.

🤖 Generated with Claude Code

Recognize mixed-case and multi-part PHP file extensions (e.g. functions.PHP,
functions.php.bak) when collecting a theme's files, so those files are routed
through the PHP checks alongside plain .php files.

Also make the presence-based checks child-theme aware: child themes now only
skip the requirements their parent supplies (base template functions,
index.php, and title-tag support) via a new tc_is_child_theme() helper,
instead of appearing to fail checks their parent already satisfies.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 1, 2026 15:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Theme Check’s scanning accuracy by (1) broadening PHP file detection during file collection and (2) reducing requirement-based false positives when scanning child themes in isolation.

Changes:

  • Add tc_is_php_file() and use it in run_themechecks_against_theme() to classify PHP files based on any PHP-related extension component (case-insensitive).
  • Add tc_is_child_theme() and use it to skip certain parent-provided requirements in Basic_Check, File_Check (index.php), and Theme_Support_Title_Tag_Check.
  • Update changelog.txt for the upcoming release notes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
checks/class-theme-support-title-tag.php Skips the title-tag support requirement for child themes.
checks/class-file-check.php Exempts index.php from required files when scanning a child theme.
checks/class-basic-check.php Skips classic base-template function presence checks for child themes.
checkbase.php Adds tc_is_child_theme() and tc_is_php_file(), and uses the new PHP routing helper.
changelog.txt Documents the two scanning-accuracy fixes for the next release.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread checkbase.php
@obenland
obenland requested a review from kafleg September 1, 2026 15:08
…hp exemption

Recognize .css regardless of case, mirroring the PHP handling, and fold the
FSE and child-theme index.php exemptions into a single guarded removal.

Co-Authored-By: Claude Fable 5 <[email protected]>
@obenland
obenland merged commit b93841f into master Sep 1, 2026
2 checks passed
@obenland
obenland deleted the fix/file-scanning-accuracy branch September 1, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants