Skip to content

Add early exit clauses to files with procedural code #790

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

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

felixarntz
Copy link
Member

Summary

This was flagged during plugin review of the "Dominant Color Images" submission. Any files with procedural code should have an early exit condition. Most typically the one based on whether ! defined( 'ABSPATH' ), but another relevant constant can used as well. For example, in the files where we already check for a Performance Lab specific constant on top of the file, we don't have to add to or update those files.

Keep in mind that this is only required for files with procedural code, i.e. not files that only contain a class or similar construct.

There are varying opinions on this approach, but given it's requested by the plugin review team and is not a big deal to add, let's follow the pattern.

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@felixarntz felixarntz added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall performance plugin infrastructure labels Jul 25, 2023
@felixarntz felixarntz added this to the PL Plugin 2.6.0 milestone Jul 25, 2023
@felixarntz felixarntz merged commit d548c69 into trunk Jul 25, 2023
@felixarntz felixarntz deleted the fix/procedural-files-early-exit branch July 25, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants