Improve theme file scanning accuracy - #500
Merged
Merged
Conversation
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]>
There was a problem hiding this comment.
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 inrun_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 inBasic_Check,File_Check(index.php), andTheme_Support_Title_Tag_Check. - Update
changelog.txtfor 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.
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A couple of accuracy improvements to how themes are scanned.
PHP file collection. File-type routing keyed only on a lowercase, final
.phpsuffix, so names likefunctions.PHPorfunctions.php.bakwere treated as "other" files and skipped the PHP checks. A newtc_is_php_file()helper matches any PHP extension component case-insensitively, so those files are scanned like plain.phpfiles.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.phpinFile_Check, andTheme_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
phpcsclean against the repo standard.🤖 Generated with Claude Code