78% remove-extra-media

Code Review | Remove Extra Media

WordPress plugin Remove Extra Media scored78%from 54 tests.

About plugin

  • Plugin page: remove-extra-media
  • Plugin version: 1.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9.2-4.3.0
  • WordPress version: 6.3.1
  • First release: Sep 22, 2013
  • Latest release: Jun 18, 2015
  • Number of updates: 11
  • Update frequency: every 57.6 days
  • Top authors: comprock (81.82%)saurabhd (27.27%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,694 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.01MB] [CPU: ▼9.12ms] Passed 4 tests

This is a short check of server-side resources used by Remove Extra Media
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.83 ▼1.35
Dashboard /wp-admin3.33 ▼0.0146.52 ▼18.75
Posts /wp-admin/edit.php3.48 ▲0.1256.70 ▲13.22
Add New Post /wp-admin/post-new.php5.92 ▲0.0386.65 ▼17.66
Media Library /wp-admin/upload.php3.26 ▲0.0337.04 ▲1.30
Remove Extra Media /wp-admin/options-general.php?page=remove-extra-media-settings3.2434.08
Remove Extra Media Processer /wp-admin/tools.php?page=remove-extra-media3.2333.16

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 45 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
remove-extra-media-settings
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Remove Extra Media
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,823 ▲7713.20 ▼1.211.86 ▼0.0347.35 ▲3.36
Dashboard /wp-admin2,229 ▲265.79 ▼0.02101.33 ▼18.7538.97 ▼4.91
Posts /wp-admin/edit.php2,108 ▲82.04 ▲0.0340.65 ▲0.9335.58 ▼2.97
Add New Post /wp-admin/post-new.php1,556 ▲3023.20 ▲5.55656.01 ▲60.4962.21 ▲4.58
Media Library /wp-admin/upload.php1,405 ▲54.26 ▲0.02100.35 ▼0.8049.91 ▲6.36
Remove Extra Media /wp-admin/options-general.php?page=remove-extra-media-settings1,1272.0145.3857.91
Remove Extra Media Processer /wp-admin/tools.php?page=remove-extra-media8431.8027.3329.76

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • remove-extra-media-settings
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=remove-extra-media-settings
    • > User deprecated in wp-includes/functions.php+5453
    Function wp_htmledit_pre is deprecated since version 4.3.0! Use format_for_editor() instead.
    • > GET request to /wp-admin/options-general.php?page=remove-extra-media-settings
    • > Deprecated in wp-content/plugins/remove-extra-media/lib/class-remove-extra-media-settings.php+408
    Non-static method Remove_Extra_Media_Settings::display_about() should not be called statically

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      require_once(): Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/remove-extra-media/ci/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/remove-extra-media/ci/tests/class.sample-test.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/remove-extra-media/remove-extra-media.php:560
    • > PHP Warning
      require_once(/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/remove-extra-media/ci/tests/bootstrap.php on line 3

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
3 plugin tags: remove, posts, media

remove-extra-media/remove-extra-media.php Passed 13 tests

The principal PHP file in "Remove Extra Media" v. 1.1.1 is loaded by WordPress automatically on each request
87 characters long description:
Use Remove Extra Media to remove extra media attachments from your selected post types.

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
There were no executable files found in this plugin2,504 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP54162101,244
CSS22034450
PO File2128146441
Markdown5550108
JavaScript1272098
Bourne Shell222486
XML311577

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity40.50
▷ Minimum class complexity1.00
▷ Maximum class complexity111.00
Average method complexity3.59
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods61
▷ Static methods4878.69%
▷ Public methods61100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
18 PNG files occupy 0.60MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png0.33KB0.16KB▼ 52.38%
css/redmond/images/ui-bg_flat_55_fbec88_40x100.png0.20KB0.08KB▼ 57.77%
css/redmond/images/ui-icons_2e83ff_256x240.png4.44KB4.17KB▼ 6.02%
css/redmond/images/ui-icons_f9bd01_256x240.png4.44KB4.17KB▼ 6.02%
css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png0.29KB0.10KB▼ 65.41%