78% image-cleanup

Code Review | Image Cleanup

WordPress plugin Image Cleanup scored 78% from 54 tests.

About plugin

  • Plugin page: image-cleanup
  • Plugin version: 1.9.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.8
  • WordPress version: 5.8.1
  • First release: Oct 12, 2013
  • Latest release: Nov 20, 2017
  • Number of updates: 79
  • Update frequency: every 19.0 days
  • Top authors: opicron (98.73%)ShortPixel (2.53%)

Code review

54 tests

User reviews

63 reviews

Install metrics

6,000+ active / 120,404 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.14MB] [CPU: ▼152.96ms] Passed 4 tests

An overview of server-side resources used by Image Cleanup
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.85 ▲0.1333.37 ▲11.75
Dashboard /wp-admin3.00 ▼0.0633.07 ▼17.21
Posts /wp-admin/edit.php3.05 ▼0.0536.20 ▼6.56
Add New Post /wp-admin/post-new.php4.99 ▼0.4473.73 ▼585.58
Media Library /wp-admin/upload.php3.00 ▲0.0030.52 ▼2.49
Image Cleanup /wp-admin/tools.php?page=ImageCleanup2.9831.68

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 6 new files
Database: no new tables, 1 new option
New WordPress options
image_cleanup_version

Browser metrics Passed 4 tests

Image Cleanup: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,713 ▲11715.83 ▲0.3814.45 ▲5.2049.92 ▼3.59
Dashboard /wp-admin2,980 ▲465.95 ▼0.18151.37 ▼4.17104.99 ▼12.65
Posts /wp-admin/edit.php2,749 ▲102.71 ▼0.0172.06 ▲9.7897.67 ▲14.06
Add New Post /wp-admin/post-new.php1,623 ▲12521.40 ▲2.61286.98 ▼102.46102.36 ▼7.14
Media Library /wp-admin/upload.php1,820 ▲135.05 ▲0.01146.34 ▼2.54122.65 ▲6.15
Image Cleanup /wp-admin/tools.php?page=ImageCleanup1,1512.1152.1666.18

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin does not fully uninstall, leaving 1 option in the database
    • image_cleanup_version

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/tools.php?page=ImageCleanup
    • > Warning in wp-content/plugins/image-cleanup/image-cleanup.plugin.php+1445
    count(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/tools.php?page=ImageCleanup
    • > Warning in wp-content/plugins/image-cleanup/image-cleanup.plugin.php+1486
    unlink(wp-content/uploads/imagecleanup//0): Is a directory
    • > GET request to /wp-admin/tools.php?page=ImageCleanup
    • > Warning in wp-content/plugins/image-cleanup/image-cleanup.plugin.php+1486
    unlink(wp-content/uploads/imagecleanup//0/logs): Is a directory

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/image-cleanup/image-cleanup.file-table.class.php on line 4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/image-cleanup/image-cleanup.file-table.class.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/image-cleanup/image-cleanup.backup-table.class.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/image-cleanup/image-cleanup.file-table.class.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
3 plugin tags: cleanup, image, clean

image-cleanup/image-cleanup.plugin.php 92% from 13 tests

"Image Cleanup" version 1.9.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("image-cleanup.php" instead of "image-cleanup.plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin1,735 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP34293971,578
JavaScript1163157

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity90.33
▷ Minimum class complexity7.00
▷ Maximum class complexity201.00
Average method complexity4.94
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods68
▷ Static methods11.47%
▷ Public methods68100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants12
▷ Global constants00.00%
▷ Class constants12100.00%
▷ Public constants12100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin