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

Aperta
#459 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
tooling

Direzione di ricerca

Poiché non sono indicati file o test, inizia tracciando il flusso attuale dei controlli e dei risultati del plugin. Esamina gli esempi di console e JSON in PR #458, quindi verifica che i controlli mantengano dati strutturati di tipo/messaggio e che ogni formato di output possa visualizzarli senza analizzare HTML.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
PHP
Stelle
372
Fork
114
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/theme-check

Tutte le issue di WordPress/theme-check

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.