Share dependency-size logic between the enqueued scripts and styles checks
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Read Enqueued_Scripts_Size_Check and Enqueued_Styles_Size_Check, then inspect the dependency counting added for #1488 and the discussion on #74. Extract the shared dependency traversal, URL to file resolution, size counting, threshold check, and warning into a reusable base or trait while preserving each check’s registry, handle filter, and warning message. Done means styles count dependencies, including inline code and core dependencies, and both checks use the shared logic.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What problem does it solve?
Enqueued_Scripts_Size_Check and Enqueued_Styles_Size_Check are near-identical: both walk the enqueued handles for a plugin, resolve each one to a local file, add up the bytes, and warn past a threshold. #1488 taught the scripts check to also count the dependencies a handle pulls in (recursively, de-duplicated, including inline before/after code and core deps like jQuery). The styles check still only measures the plugin's own files.
So after #1488 the two checks diverge. A plugin whose stylesheet depends on a large shared stylesheet stays under the radar, while the equivalent script does not. On #74 the suggestion was to converge the two first so this logic lives in one place:
Might be easiest to first converge this class with
Enqueued_Styles_Size_Check(e.g. by adding an abstract class or trait) so this logic can be reused.
#1488 kept its scope to the scripts check to stay reviewable, so this is the tracked follow-up.
Proposed approach
Pull the shared parts (dependency walk, src-to-path resolution across the URL roots, file and inline size counting, the threshold comparison and warning) into an abstract base or a trait, and have both size checks extend or use it. The scripts and styles registries share the same WP_Dependencies shape, so the walk is the same; the per-check pieces are the registry (wp_scripts() vs wp_styles()), the handle filter, and the warning code and message.
Outcome: dependency counting applies to stylesheets too, and the two checks can't drift apart again.
Happy to take this on once #1488 lands.
- Lenguaje dominante
- PHP
- Estrellas
- 365
- Forks
- 135
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 20
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Posiblemente ocupada @anandrajaram21 la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
WordPress/plugin-check#1556 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add opt-in .distignore exclusions for local and CI scansPosiblemente ocupada @jakaria-istauk la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
WordPress/plugin-check#1559 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
WordPress/plugin-check#1555 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsPosiblemente ocupada @elphizu la tomó hace 7 días. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 35/100
WordPress/plugin-check#1553 ·
Los mantenedores suelen responder en 1 día
-
Add checks to detect jQuery 4 incompatibilities ahead of WordPress 7.2 / 7.3Posiblemente ocupada @avinash-addweb la tomó hace 12 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
WordPress/plugin-check#1549 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de WordPress/plugin-check
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ExpressionEngine/ExpressionEngine#5493 ·
Los mantenedores suelen responder en 5 días
-
"Attempt to read property 'username' on null" error after a user is deletedPosiblemente ocupada @dicksonlaw583 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
quantum-php/project#222 ·
-
support
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día