61% wp-smushit

Code Review | Smush - Optimize, Compress and Lazy Load Images

WordPress plugin Smush - Optimize, Compress and Lazy Load Images scored61%from 54 tests.

About plugin

  • Plugin page: wp-smushit
  • Plugin version: 3.15.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4
  • WordPress version: 6.3.1
  • First release: Dec 5, 2008
  • Latest release: Nov 15, 2023
  • Number of updates: 463
  • Update frequency: every 11.8 days
  • Top authors: UmeshSingla (26.57%)alexdunae (25.05%)jdailey (18.79%)WPMUDEV (12.74%)vanyukov (9.5%)

Code review

54 tests

User reviews

5936 reviews

Install metrics

1,000,000+ active /49,425,464 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲4.73MB] [CPU: ▲32.65ms] Passed 4 tests

Server-side resources used by Smush - Optimize, Compress and Lazy Load Images
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /7.10 ▲3.6464.76 ▲27.32
Dashboard /wp-admin8.40 ▲5.0988.56 ▲38.09
Posts /wp-admin/edit.php8.44 ▲5.0882.15 ▲33.81
Add New Post /wp-admin/post-new.php11.11 ▲5.22131.61 ▲31.39
Media Library /wp-admin/upload.php8.32 ▲5.0974.44 ▲39.60
Smush Pro /wp-admin/admin.php?page=smush-upgrade8.3665.26
Directory Smush /wp-admin/admin.php?page=smush-directory8.6290.75
Local WebP /wp-admin/admin.php?page=smush-webp8.69127.11
Bulk Smush /wp-admin/admin.php?page=smush-bulk8.7088.56
Tutorials /wp-admin/admin.php?page=smush-tutorials8.3766.39
Settings /wp-admin/admin.php?page=smush-settings8.4379.89
Dashboard /wp-admin/admin.php?page=smush8.74144.01
Lazy Load /wp-admin/admin.php?page=smush-lazy-load8.6177.55
CDN /wp-admin/admin.php?page=smush-cdn8.6171.22
Integrations /wp-admin/admin.php?page=smush-integrations8.4270.66

Server storage [IO: ▲12.52MB] [DB: ▲0.01MB] 67% from 3 tests

A short overview of filesystem and database impact
These are issues you should consider
  • Illegal file modification detected: 1 file (0.06KB) outside of "wp-content/plugins/wp-smushit/" and "wp-content/uploads/"
    • (new file) wp-content/smush-webp/smush-webp-test.png.webp
Filesystem: 584 new files
Database: 1 new table, 8 new options
New tables
wp_smush_dir_images
New WordPress options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts
theysaidso_admin_options
wp_smush_image_sizes_state
wp-smush-settings
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Smush - Optimize, Compress and Lazy Load Images
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,924 ▲16214.38 ▲0.101.68 ▼0.1143.11 ▼2.24
Dashboard /wp-admin2,332 ▲1525.69 ▲0.0390.44 ▼6.8142.34 ▼3.94
Posts /wp-admin/edit.php2,181 ▲812.00 ▲0.0640.44 ▲1.7037.26 ▲4.20
Add New Post /wp-admin/post-new.php1,590 ▲6023.81 ▲0.78618.24 ▲9.0632.43 ▼20.10
Media Library /wp-admin/upload.php1,541 ▲1446.12 ▲1.92122.94 ▲21.9142.83 ▼0.24
Smush Pro /wp-admin/admin.php?page=smush-upgrade1,7829.51197.92165.77
Directory Smush /wp-admin/admin.php?page=smush-directory1,7182.7647.7990.06
Local WebP /wp-admin/admin.php?page=smush-webp1,5453.5064.7969.16
Bulk Smush /wp-admin/admin.php?page=smush-bulk2,2353.3258.4182.09
Tutorials /wp-admin/admin.php?page=smush-tutorials1,5855.6357.6878.39
Settings /wp-admin/admin.php?page=smush-settings1,4633.3958.8575.91
Dashboard /wp-admin/admin.php?page=smush2,7286.5396.0593.03
Lazy Load /wp-admin/admin.php?page=smush-lazy-load1,5072.7452.2654.68
CDN /wp-admin/admin.php?page=smush-cdn1,5342.7649.5054.39
Integrations /wp-admin/admin.php?page=smush-integrations1,5362.6449.2677.87

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie tables detected upon uninstall: 1 table
    • wp_smush_dir_images
  • The uninstall procedure has failed, leaving 8 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • wp_smush_image_sizes_state
    • widget_recent-comments
    • wp-smush-settings

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/wp-smushit/app/views/email/footer.php
    • > /wp-content/plugins/wp-smushit/vendor/mixpanel/mixpanel-php/examples/custom_consumer.php
    • > /wp-content/plugins/wp-smushit/vendor/mixpanel/mixpanel-php/examples/error_handling.php
  • 206× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Smush\\Core\\Controller' not found in wp-content/plugins/wp-smushit/core/smush/class-smush-controller.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Smush\\Core\\Media\\Media_Item_Optimization_Global_Stats' not found in wp-content/plugins/wp-smushit/core/smush/class-smush-optimization-global-stats.php:7
    • > [ Base_MixpanelBase - line 94 ]
      destruct flush attempt #1
    • > [ Base_MixpanelBase - line 76 ]
      Using token: MIXPANEL_PROJECT_TOKEN
    • > PHP Fatal error
      Uncaught Error: Class 'Smush\\Core\\Media\\Media_Item_Stats' not found in wp-content/plugins/wp-smushit/core/smush/class-smush-media-item-stats.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wp-smushit/app/common/circle-progress-bar.php:9
    • > [ Base_MixpanelBase - line 213 ]
      Socket wrote 485 bytes
    • > [ Base_MixpanelBase - line 18 ]
      Instantiated new Consumer
    • > [ ObConsumer - line 8 ]
      This is the data from a fake error
    • > [ Base_MixpanelBase - line 196 ]
      Queued message: {"event":"test_event","properties":{"mp_lib":"php","color":"blue","token":"MIXPANEL_PROJECT_TOKEN","time":1700124716.38044}}

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=smush
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=smush - Access to fetch at 'https://wpmudev.com/blog/wp-json/wp/v2/media/194208' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
    • > GET request to /wp-admin/admin.php?page=smush
    • > Network (severe)
    https://wpmudev.com/blog/wp-json/wp/v2/media/194208 - Failed to load resource: net::ERR_FAILED

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
Please take inspiration from this readme.txt

wp-smushit/wp-smush.php 85% from 13 tests

Analyzing the main PHP file in "Smush - Optimize, Compress and Lazy Load Images" version 3.15.1
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 143 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wp-smushit.php" instead of "wp-smush.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected57,987 lines of code in 399 files:
LanguageFilesBlank linesComment linesLines of code
PHP2567,63715,58632,103
HTML241,63316810,659
JavaScript721,2221,7987,538
Sass10407502,844
CSS12130311,867
SVG124261,481
JSX67955973
Markdown41000418
JSON20078
XML13026

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity27.13
▷ Minimum class complexity1.00
▷ Maximum class complexity223.00
Average method complexity3.04
▷ Minimum method complexity1.00
▷ Maximum method complexity36.00
Code structure
Namespaces24
Interfaces1
Traits0
Classes165
▷ Abstract classes148.48%
▷ Concrete classes15191.52%
▷ Final classes21.32%
Methods2,170
▷ Static methods974.47%
▷ Public methods1,47668.02%
▷ Protected methods1225.62%
▷ Private methods57226.36%
Functions67
▷ Named functions34.48%
▷ Anonymous functions6495.52%
Constants109
▷ Global constants2018.35%
▷ Class constants8981.65%
▷ Public constants89100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
110 PNG files occupy 1.09MB with 0.56MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
app/assets/images/incsub-logo@2x.png4.15KB2.29KB▼ 44.90%
core/external/free-dashboard/assets/images/giveaway/success/common@2x.png6.88KB3.56KB▼ 48.22%
core/external/plugin-notice/assets/images/plugins-hustle.png16.29KB5.50KB▼ 66.23%
core/external/free-dashboard/assets/images/giveaway/form/defender.png4.24KB2.41KB▼ 43.20%
app/assets/images/onboarding/graphic-onboarding-usage@2x.png20.49KB9.39KB▼ 54.17%