WordPress / WordPress/theme-check
Handle checks and results as a structured array instead of an array of strings.
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 371
- Forks
- 113
- Avg merge
- 8m
- Merged PRs (30d)
- 5
Description
What?
Currently, the errors produced by the check class are a list of strings containing HTML tags. This makes using these messages difficult for something that's not printing the results to an HTML page.
Exampe:
"<span class="tc-lead tc-warning">WARNING</span>: <strong>screenshot.png</strong> is 704.2 KB in size. Large file sizes have a negative impact on website performance and loading time. Compress images before using them."
If we the plugin can handle the messages as a list of objects (PHP relational arrays) and format just before outputting them, it would be easier to handle that in different formats (Html page, console output, JSON).
Example of 2 different outputs being implemented (console and json in the console): https://github.com/WordPress/theme-check/pull/458
Expected
The plugin could handle the errors like this. In this way, each output handler could format it accordingly without parsing or removing HTML.
$checks = array (
array(
'type' => 'ERROR',
'message' => 'This is an error text'
),
array(
'type' => 'WARNING',
'message' => 'This is an warning error text'
),
array(
'type' => 'INFO',
'message' => 'This is an info text'
),
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named, so start by tracing the plugin's current check and result flow. Review the console and JSON examples in PR #458, then verify that checks retain structured type/message data and that each output format can render it without parsing HTML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100