88% cleanup-duplicate-meta

Code Review | Cleanup Duplicate Meta

WordPress plugin Cleanup Duplicate Meta scored 88% from 54 tests.

About plugin

  • Plugin page: cleanup-duplicate...
  • Plugin version: 1.0.2
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.2.1
  • WordPress version: 5.8.1
  • First release: May 9, 2015
  • Latest release: May 9, 2015
  • Number of updates: 8
  • Update frequency: every 0.1 days
  • Top authors: hellofromTonya (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

400+ active / 6,872 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.13MB] [CPU: ▼138.66ms] Passed 4 tests

A check of server-side resources used by Cleanup Duplicate Meta
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.89 ▲0.1739.61 ▲17.76
Dashboard /wp-admin3.22 ▲0.1742.74 ▼3.49
Posts /wp-admin/edit.php3.27 ▲0.1645.85 ▲2.34
Add New Post /wp-admin/post-new.php5.52 ▲0.09103.72 ▼540.33
Media Library /wp-admin/upload.php3.10 ▲0.0934.26 ▼13.16
Cleanup Duplicates /wp-admin/tools.php?page=cleanup_dup_meta3.0831.58

Server storage [IO: ▲0.43MB] [DB: ▲0.00MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 32 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Cleanup Duplicate Meta
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,708 ▲11216.21 ▲0.779.82 ▲1.1545.36 ▼7.04
Dashboard /wp-admin2,978 ▲445.90 ▼0.04143.64 ▼8.48113.89 ▲3.56
Posts /wp-admin/edit.php2,744 ▲52.68 ▼0.0260.27 ▼8.8693.00 ▼5.83
Add New Post /wp-admin/post-new.php1,618 ▲321.36 ▲0.25279.14 ▼16.58119.25 ▲1.83
Media Library /wp-admin/upload.php1,812 ▲25.02 ▲0.05154.32 ▼1.34127.97 ▼0.26
Cleanup Duplicates /wp-admin/tools.php?page=cleanup_dup_meta1,3532.2761.2998.52

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cleanup-duplicate-meta/class-plugin.php
    • > /wp-content/plugins/cleanup-duplicate-meta/plugin.php
  • 10× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cleanup-duplicate-meta/lib/config/postmeta.php:17
    • > PHP Notice
      Trying to get property 'usermeta' of non-object in wp-content/plugins/cleanup-duplicate-meta/lib/config/usermeta.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/cleanup-duplicate-meta/lib/views/menu-page.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/cleanup-duplicate-meta/lib/views/meta.php:3
    • > PHP Notice
      Trying to get property 'postmeta' of non-object in wp-content/plugins/cleanup-duplicate-meta/lib/config/postmeta.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/cleanup-duplicate-meta/lib/views/duplicates.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cleanup-duplicate-meta/lib/config/plugin.php:9
    • > PHP Warning
      Use of undefined constant CLEANUP_DUP_META_PLUGIN_DIR - assumed 'CLEANUP_DUP_META_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/cleanup-duplicate-meta/lib/config/plugin.php on line 6
    • > PHP Fatal error
      Uncaught Error: Interface 'Cleanup_Dup_Meta\\Models\\I_Model' not found in wp-content/plugins/cleanup-duplicate-meta/lib/models/class-model.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cleanup-duplicate-meta/lib/config/usermeta.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: These screenshots require images: #1 (The plugin's page in Tools > 'Cleanup Duplicates'.), #2 (Screen for both the Post Meta and User Meta controls.), #3 (An example of the table generated when clicking on 'Check for Duplicates' button. The results are sorted by meta key.), #4 (After clicking on the 'Count Duplicates' button, notification is displayed of the number of duplicates found (which could be deleted).), #5 (The message after clicking on 'Cleanup Post Meta'.)
The official readme.txt might help

cleanup-duplicate-meta/plugin.php 85% from 13 tests

The main PHP script in "Cleanup Duplicate Meta" version 1.0.2 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("cleanup-duplicate-meta.php" instead of "plugin.php")
  • Text Domain: The text domain name should consist of only dashes and lowercase characters

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin862 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP17182473648
JavaScript248124132
JSON11034
Sass18026
CSS25022

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity11.00
▷ Minimum class complexity1.00
▷ Maximum class complexity39.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces3
Interfaces1
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods45
▷ Static methods24.44%
▷ Public methods3884.44%
▷ Protected methods613.33%
▷ Private methods12.22%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants250.00%
▷ Class constants250.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.38MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-5.png65.25KB15.45KB▼ 76.32%
screenshot-1.png149.54KB42.80KB▼ 71.38%
screenshot-3.png51.42KB12.67KB▼ 75.36%
screenshot-2.png65.50KB16.99KB▼ 74.06%
screenshot-4.png57.91KB14.60KB▼ 74.79%