Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle checks and results as a structured array instead of an array of strings. #459

Open
matiasbenedetto opened this issue Sep 6, 2024 · 0 comments

Comments

@matiasbenedetto
Copy link
Collaborator

matiasbenedetto commented Sep 6, 2024

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."

image

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): #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'
    ),
)
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

No branches or pull requests

1 participant