Create Enqueued_Scripts_Scope_Check #23
Labels
Checks
Audit/test of the particular part of the plugin
[Team] Performance
Issues owned by Performance Team
[Type] Enhancement
A suggestion for improvement of an existing feature
Description
Checks that scripts are only enqueued in certain contexts and not just everywhere. While a theme often enqueues scripts or styles that are needed for the entire site, plugins usually have specific behaviors that often do not affect the entire site. Such plugins should not just call wp_enqueue_script() on the wp_enqueue_scripts action, but have conditional logic in there to only enqueue the script when needed based on context. This check would load different contexts (simulating different URLs) of different kinds and warn if a script is enqueued on all of them.
Acceptance Criteria
Enqueued_Scripts_Scope_Check
should be created and exists atincludes/Checker/Checks
Enqueued_Scripts_Scope_Check
should extend theRuntime_Check
abstract class which extendsCheck
interface$violation
code should bewarning
run
should be implemented from theRuntime_Check
abstract class if neededCheck_Result $check_result
should be used from therun
method parameter to append the resultsTest Coverage
Enqueued_Scripts_Scope_Check
class is expected to extendRuntime_Check
classEnqueued_Scripts_Scope_Check
class is expected to be instance ofRuntime_Check
classrun
method expected to append the audit results to$check_result
The text was updated successfully, but these errors were encountered: