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 moved this to Backlog in Plugin Check Nov 23, 2022
@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
@FlicHollis FlicHollis moved this from Backlog to Definition in Plugin Check Nov 29, 2022
@eclarke1 eclarke1 moved this from Definition to Backlog in Plugin Check Nov 29, 2022
@mehulkaklotar mehulkaklotar moved this from Backlog to Definition in Plugin Check Dec 9, 2022
@mehulkaklotar mehulkaklotar added the 7 label Dec 9, 2022
@mehulkaklotar mehulkaklotar moved this from Definition to AC Review in Plugin Check Dec 9, 2022
@eclarke1 eclarke1 moved this from AC Review to Definition in Plugin Check Feb 6, 2023
@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! 🙂

@vishalkakadiya vishalkakadiya moved this from Definition to AC Review in Plugin Check Feb 8, 2023
@swissspidy swissspidy added [Team] Performance Issues owned by Performance Team and removed Milestone 3 labels Jun 6, 2024
@swissspidy swissspidy removed the 7 label Jun 6, 2024
@github-project-automation github-project-automation bot moved this from AC Review to Done in Plugin Check Jul 3, 2024
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants