Skip to content

Conversation

@bhubbard
Copy link
Contributor

@bhubbard bhubbard commented Dec 10, 2025

  • 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');

Summary by CodeRabbit

  • Chores

    • Introduced project-wide editor configuration for consistent coding standards across the team.
  • Refactor

    • Improved uninstall process reliability and consistency through code restructuring.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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');```
@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Walkthrough

The 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

Cohort / File(s) Change Summary
Configuration & Style
\.editorconfig
New file establishing global coding conventions (charset UTF-8, Unix line endings, tab indentation) with overrides for YAML (2-space indents), Markdown (preserve trailing whitespace), and legacy formats (CRLF line endings).
Plugin Uninstall
uninstall\.php
Replaced include_once with require_once; refactored permission guard from multi-line defined() check to compact !defined() with exit; adjusted comment spacing and standardized delete_option() call formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Extra attention areas:
    • Verify the permission guard logic change in uninstall.php maintains intended security (!defined() with exit is functionally equivalent to previous defined() guard)
    • Confirm .editorconfig overrides (especially CRLF for TXT and wp-config-sample.php) align with project requirements

Poem

🐰 A rabbit hops through configs new,
With tabs and spaces, all in view,
The uninstall's tidy, trim and tight,
Require once—it's done just right!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions 'editorconifg' which appears to be a typo for 'editorconfig', and covers the main changes (added .editorconfig and phpcs fixes for uninstall file).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 *.yaml and ensuring newline at EOF

If this repo ever uses .yaml in addition to .yml, you may want to include it in the YAML section; also, since insert_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 consistent

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between ab17138 and 5dbe3a2.

⛔ Files ignored due to path filters (1)
  • composer.lock is 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 conventions

Settings (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.

Comment on lines +11 to 18
// 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;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Move uninstall guard before helper include and drop commented‑out include

Two things here:

  1. For hardening, it’s better to bail out before loading any helpers so uninstall.php does nothing when hit directly.
  2. The commented‑out include_once is the PHPCS “commented‑out code” violation you mentioned and is redundant now that require_once is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant