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

Create Enqueued_Resources_Check #25

Closed
mehulkaklotar opened this issue Nov 21, 2022 · 1 comment · Fixed by #331
Closed

Create Enqueued_Resources_Check #25

mehulkaklotar opened this issue Nov 21, 2022 · 1 comment · Fixed by #331
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

Comments

@mehulkaklotar
Copy link
Member

mehulkaklotar commented Nov 21, 2022

Description

Checks that all plugin scripts and styles are enqueued using core functions and not directly output in HTML. This will use the existing WordPress.WP.EnqueuedResources sniff in the WordPress Coding Standards.

Acceptance Criteria

  • Class Enqueued_Resources_Check should be created and exists at includes/Checker/Checks
  • Class Enqueued_Resources_Check should extend the Abstract_PHP_CodeSniffer_Check abstract class
  • Class should implement the public get_args() and return an associative array of the required PHPCS arguments
    • 'sniffs' => 'WordPress.WP.EnqueuedResources'
    • 'standard' => 'WordPress'
  • Add a sample <link> in the tests/testdata/plugins/test-plugin-with-errors\test-plugin-with-errors.php file to include any sample script. Make sure it will come under the WordPress.WP.EnqueuedResources error.

Tests Coverage

  • get_args() method returns the expected array of PHPCS arguments for the check
  • run() method adds warnings to the $check_result when checking an invalid file - check reference here
  • run() method does not add any warnings to the $check_result when checking a valid file - check reference here
@mehulkaklotar mehulkaklotar added [Type] Enhancement A suggestion for improvement of an existing feature Checks Audit/test of the particular part of the plugin Infrastructure Issues for the overall plugin infrastructure and removed Infrastructure Issues for the overall plugin infrastructure labels Nov 23, 2022
@mehulkaklotar mehulkaklotar added the 7 label Dec 9, 2022
@vishalkakadiya vishalkakadiya self-assigned this Feb 8, 2023
@vishalkakadiya
Copy link

@felixarntz I have updated AC for this epic, and it is ready for review now. Thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
5 participants