68% lws-optimize

Code Review | LWS Optimize

WordPress plugin LWS Optimize scored68%from 54 tests.

About plugin

  • Plugin page: lws-optimize
  • Plugin version: 1.9.1
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.3
  • WordPress version: 6.3.1
  • First release: Nov 24, 2022
  • Latest release: Oct 5, 2023
  • Number of updates: 17
  • Update frequency: every 18.6 days
  • Top authors: aurelienlws (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

4,000+ active /17,047 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.23MB] [CPU: ▲1.39ms] Passed 4 tests

An overview of server-side resources used by LWS Optimize
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2554.27 ▲15.69
Dashboard /wp-admin3.53 ▲0.2248.44 ▼3.23
Posts /wp-admin/edit.php3.65 ▲0.2951.40 ▲8.17
Add New Post /wp-admin/post-new.php6.11 ▲0.2289.10 ▼5.06
Media Library /wp-admin/upload.php3.45 ▲0.2240.13 ▲5.66

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 164 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for LWS Optimize
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,953 ▲19214.24 ▼0.112.06 ▲0.5444.31 ▲6.61
Dashboard /wp-admin2,322 ▲1425.58 ▼0.0481.10 ▼6.8873.95 ▲31.38
Posts /wp-admin/edit.php2,242 ▲1421.98 ▼0.0035.57 ▼4.1232.75 ▼3.34
Add New Post /wp-admin/post-new.php1,659 ▲13323.51 ▼0.07699.59 ▲19.6054.39 ▼11.65
Media Library /wp-admin/upload.php1,539 ▲1364.13 ▼0.0692.72 ▼8.1175.69 ▲27.06

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/lws-optimize/lws-optimize.php+107
    rmdir(wp-content/uploads/lws-optimize): Directory not empty
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
Please fix the following items
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/lws-optimize/classes/min/server-info.php
    • > /wp-content/plugins/lws-optimize/classes/min/index.php
    • > /wp-content/plugins/lws-optimize/classes/min/builder/ocCheck.php
    • > /wp-content/plugins/lws-optimize/classes/min/builder/index.php
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/lws-optimize/views/plugins.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/lws-optimize/views/object-cache.php:536
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/lws-optimize/views/tabs.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Minify_Controller_Base' not found in wp-content/plugins/lws-optimize/classes/min/lib/Minify/Controller/Files.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Minify_Controller_Base' not found in wp-content/plugins/lws-optimize/classes/min/lib/Minify/Controller/Groups.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/lws-optimize/views/medias.php:105
    • > PHP Fatal error
      Uncaught Error: Class 'Minify_Controller_Base' not found in wp-content/plugins/lws-optimize/classes/min/lib/Minify/Controller/Page.php:14
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/lws-optimize/views/medias.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/lws-optimize/views/frontend.php:4
    • > PHP Fatal error
      The script "class.JavaScriptPacker.php" is required. Please see: http://code.google.com/p/minify/source/browse/trunk/min/lib/Minify/Packer.php in wp-content/plugins/lws-optimize/classes/min/lib/Minify/Packer.php on line 21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
4 plugin tags: optimisation, lws, cache, admin

lws-optimize/lws-optimize.php Passed 13 tests

The entry point to "LWS Optimize" version 1.9.1 is a PHP file that has certain tags in its header comment area
138 characters long description:
Reach better speed and performances with Optimize! Minification, Combination, Media conversion... Everything you need for a better website

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected11,998 lines of code in 146 files:
LanguageFilesBlank linesComment linesLines of code
PHP581,4753,9478,683
SVG765691,583
CSS314895857
JavaScript6372315
PO File1150156312
Java17477231
JSON10017

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 155)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity25.48
▷ Minimum class complexity1.00
▷ Maximum class complexity229.00
Average method complexity5.36
▷ Minimum method complexity1.00
▷ Maximum method complexity155.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes54
▷ Abstract classes11.85%
▷ Concrete classes5398.15%
▷ Final classes00.00%
Methods304
▷ Static methods6421.05%
▷ Public methods19162.83%
▷ Protected methods4715.46%
▷ Private methods6621.71%
Functions70
▷ Named functions6998.57%
▷ Anonymous functions11.43%
Constants125
▷ Global constants10382.40%
▷ Class constants2217.60%
▷ Public constants22100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icon-256x256.png36.35KB9.15KB▼ 74.82%
images/logo_lws.png7.05KB3.16KB▼ 55.23%
images/logo.png1.66KB1.64KB▼ 1.18%