-
Notifications
You must be signed in to change notification settings - Fork 3
Take 2: Added editorconifg, and ran phpcs fixes for uninstall file #16
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
base: main
Are you sure you want to change the base?
Conversation
- Updated composer packages
- Added editorconfig file
- Ran phpcs fixes for uninstall.php
There is one remaining issue which is a commented out line to include one file:
```include_once ('remove_mu_plugins_batcache_on_uninstall.php');```
WalkthroughThe changes introduce a project-wide .editorconfig file to standardize coding conventions and refactor uninstall.php to use require_once and simplify permission checks while preserving all existing deletion behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.editorconfig (1)
16-23: Consider covering*.yamland ensuring newline at EOFIf this repo ever uses
.yamlin addition to.yml, you may want to include it in the YAML section; also, sinceinsert_final_newline = true, ensure this file itself ends with a newline to avoid minor tooling warnings.uninstall.php (1)
20-61: Option cleanup block looks consistentThe
delete_option()list is straightforward and consistent; behaviorally this matches a typical uninstall routine. If you ever want to DRY it up, you could push the option names into an array and loop, but that’s purely a style/maintainability choice, not a blocker.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
.editorconfig(1 hunks)uninstall.php(1 hunks)
🔇 Additional comments (1)
.editorconfig (1)
1-24: Editorconfig matches WordPress conventionsSettings (tabs for code, LF by default, CRLF for
wp-config-sample.php, no trimming in Markdown) all look consistent with typical WordPress standards. Nothing blocking here.
| // include file containing function to remove batcache on wp-config.php | ||
| // include_once ('remove_mu_plugins_batcache_on_uninstall.php'); | ||
| include_once( plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php' ); | ||
|
|
||
| // exit if uninstall constant is not defined | ||
| if (!defined('WP_UNINSTALL_PLUGIN')) | ||
| { | ||
|
|
||
| exit; | ||
| require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php'; | ||
|
|
||
| // Exit if uninstall constant is not defined. | ||
| if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { | ||
| exit; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move uninstall guard before helper include and drop commented‑out include
Two things here:
- For hardening, it’s better to bail out before loading any helpers so
uninstall.phpdoes nothing when hit directly. - The commented‑out
include_onceis the PHPCS “commented‑out code” violation you mentioned and is redundant now thatrequire_onceis in place.
You can address both with something like:
-// include file containing function to remove batcache on wp-config.php
-// include_once ('remove_mu_plugins_batcache_on_uninstall.php');
-require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php';
-
-// Exit if uninstall constant is not defined.
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
- exit;
-}
+// Exit if uninstall constant is not defined.
+if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
+ exit;
+}
+
+// Include file containing function to remove batcache on wp-config.php.
+require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php';This should both satisfy PHPCS and follow the usual WordPress uninstall pattern.
🤖 Prompt for AI Agents
In uninstall.php around lines 11 to 18, move the uninstall guard check (if ( !
defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; }) to the top of this block so it
executes before any helper files are loaded, and remove the commented-out
include_once line (the commented-out code) since require_once already loads the
helper; ensure the file now first checks WP_UNINSTALL_PLUGIN and returns
immediately if not defined, then includes/remove the helper via require_once.
There is one remaining issue which is a commented out line to include one file:
include_once ('remove_mu_plugins_batcache_on_uninstall.php');Summary by CodeRabbit
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.