73% wp-smushit

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

WordPress plugin Smush - Lazy Load Images, Optimize & Compress Images scored 73% from 54 tests.

About plugin

  • Plugin page: wp-smushit
  • Plugin version: 3.9.5
  • PHP compatiblity: 5.6.20+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-5.9
  • WordPress version: 5.8.1
  • First release: Dec 5, 2008
  • Latest release: Jan 25, 2022
  • Number of updates: 434
  • Update frequency: every 11.1 days
  • Top authors: UmeshSingla (28.34%)alexdunae (26.73%)jdailey (20.05%)WPMUDEV (13.59%)vanyukov (8.76%)

Code review

54 tests

User reviews

5803 reviews

Install metrics

1,000,000+ active / 36,105,837 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: ▲0.38MB] [CPU: ▼143.65ms] Passed 4 tests

Server-side resources used by Smush - Lazy Load Images, Optimize & Compress Images
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.02 ▲0.1931.13 ▲2.08
Dashboard /wp-admin3.50 ▲0.4442.85 ▼3.17
Posts /wp-admin/edit.php3.56 ▲0.4545.66 ▲15.01
Add New Post /wp-admin/post-new.php5.88 ▲0.4483.66 ▼582.33
Media Library /wp-admin/upload.php3.45 ▲0.4533.09 ▲8.82
Directory Smush /wp-admin/admin.php?page=smush-directory3.5891.22
Tools /wp-admin/admin.php?page=smush-tools3.5764.54
Tutorials /wp-admin/admin.php?page=smush-tutorials3.4667.78
Bulk Smush /wp-admin/admin.php?page=smush-bulk3.6178.77
Lazy Load /wp-admin/admin.php?page=smush-lazy-load3.5569.25
Local WebP /wp-admin/admin.php?page=smush-webp3.5195.82
Smush Pro /wp-admin/admin.php?page=smush-upgrade3.5567.28
Settings /wp-admin/admin.php?page=smush-settings3.5568.69
Integrations /wp-admin/admin.php?page=smush-integrations3.5672.90
Dashboard /wp-admin/admin.php?page=smush3.60115.16

Server storage [IO: ▲7.79MB] [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.73KB) outside of "wp-content/plugins/wp-smushit/" and "wp-content/uploads/"
    • (new file) wp-content/smush-webp/smush-webp-test.png.webp
Filesystem: 305 new files
Database: 1 new table, 1 new option
New tables
wp_smush_dir_images
New WordPress options
wp-smush-settings

Browser metrics Passed 4 tests

An overview of browser requirements for Smush - Lazy Load Images, Optimize & Compress Images
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,850 ▲24915.70 ▲0.515.66 ▲0.1775.30 ▲0.38
Dashboard /wp-admin3,113 ▲2176.13 ▼0.05113.76 ▼17.65165.39 ▼6.29
Posts /wp-admin/edit.php2,863 ▲1263.26 ▲0.0266.05 ▲1.79141.60 ▲1.19
Add New Post /wp-admin/post-new.php3,879 ▲13719.66 ▲0.63453.11 ▲9.15183.65 ▲17.33
Media Library /wp-admin/upload.php1,940 ▲1917.20 ▲1.68141.16 ▼13.71176.46 ▼28.96
Directory Smush /wp-admin/admin.php?page=smush-directory2,3235.52159.15205.47
Tools /wp-admin/admin.php?page=smush-tools1,7985.51154.31152.44
Tutorials /wp-admin/admin.php?page=smush-tutorials1,8798.30107.14161.85
Bulk Smush /wp-admin/admin.php?page=smush-bulk3,5619.34188.75208.05
Lazy Load /wp-admin/admin.php?page=smush-lazy-load1,9965.5292.16166.84
Local WebP /wp-admin/admin.php?page=smush-webp2,0276.16105.12190.62
Smush Pro /wp-admin/admin.php?page=smush-upgrade2,1989.12176.64188.96
Settings /wp-admin/admin.php?page=smush-settings1,8726.2996.95171.54
Integrations /wp-admin/admin.php?page=smush-integrations2,0205.5095.24157.96
Dashboard /wp-admin/admin.php?page=smush3,5218.72133.42194.90

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 1 option in the database
    • wp-smush-settings

Smoke tests 75% 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 50% 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
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_query_arg() in wp-content/plugins/wp-smushit/app/views/smush-upgrade-page.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Smush\\Core\\Modules\\Abstract_Module' not found in wp-content/plugins/wp-smushit/app/class-media-library.php:25
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-smushit/app/views/bulk/upgrade-meta-box.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_site_option() in wp-content/plugins/wp-smushit/core/external/free-dashboard/module.php:81
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/wp-smushit/core/external/plugin-notice/notice.php:266

User-side errors Passed 1 test

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

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 14 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 - Lazy Load Images, Optimize & Compress Images" version 3.9.5
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wp-smushit.php" instead of "wp-smush.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 143 characters long)

Code Analysis 97% from 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 detected26,098 lines of code in 187 files:
LanguageFilesBlank linesComment linesLines of code
PHP1214,2909,56417,746
JavaScript386921,2004,035
Sass10411452,425
JSX67955973
SVG503536
CSS52813272
Markdown2210111

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity47.46
▷ Minimum class complexity1.00
▷ Maximum class complexity203.00
Average method complexity5.20
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces10
Interfaces1
Traits0
Classes62
▷ Abstract classes69.68%
▷ Concrete classes5690.32%
▷ Final classes00.00%
Methods697
▷ Static methods476.74%
▷ Public methods52875.75%
▷ Protected methods334.73%
▷ Private methods13619.51%
Functions12
▷ Named functions00.00%
▷ Anonymous functions12100.00%
Constants24
▷ Global constants1562.50%
▷ Class constants937.50%
▷ Public constants9100.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
59 PNG files occupy 1.15MB with 0.75MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
app/assets/images/smush-webp-test.png0.46KB0.10KB▼ 78.68%
app/assets/images/onboarding/graphic-onboarding-start@2x.png42.17KB14.91KB▼ 64.65%
app/assets/images/plugins-defender-icon@2x.png8.45KB3.66KB▼ 56.66%
core/external/plugin-notice/assets/images/plugins-forminator.png11.71KB4.57KB▼ 60.99%
app/assets/images/onboarding/graphic-onboarding.png16.27KB5.69KB▼ 65.01%