77% js-css-script-optimizer

Code Review | JS & CSS Script Optimizer

WordPress plugin JS & CSS Script Optimizer scored77%from 54 tests.

About plugin

  • Plugin page: js-css-script-opt...
  • Plugin version: 0.3.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-4.8
  • WordPress version: 6.3.1
  • First release: Oct 20, 2010
  • Latest release: Jul 18, 2017
  • Number of updates: 59
  • Update frequency: every 41.8 days
  • Top authors: evgenniy (100%)

Code review

54 tests

User reviews

58 reviews

Install metrics

2,000+ active /170,696 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.18MB] [CPU: ▼9.49ms] Passed 4 tests

A check of server-side resources used by JS & CSS Script Optimizer
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.73 ▼0.7413.05 ▼26.71
Dashboard /wp-admin3.32 ▲0.0156.09 ▲1.80
Posts /wp-admin/edit.php3.37 ▲0.0151.78 ▲2.47
Add New Post /wp-admin/post-new.php5.90 ▲0.0188.05 ▼7.26
Media Library /wp-admin/upload.php3.24 ▲0.0134.33 ▼5.80
Script Optimizer /wp-admin/options-general.php?page=script-optimizer3.1837.20

Server storage [IO: ▲0.70MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
Just a few items left to fix
  • The plugin illegally modified 1 file (0.00KB) outside of "wp-content/plugins/js-css-script-optimizer/" and "wp-content/uploads/"
    • (new file) wp-content/cache/scripts/.empty
Filesystem: 16 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

JS & CSS Script Optimizer: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.26 ▼0.121.65 ▼0.2942.31 ▼0.69
Dashboard /wp-admin2,196 ▲195.51 ▼0.1883.16 ▼5.0438.76 ▼5.49
Posts /wp-admin/edit.php2,101 ▲42.05 ▲0.0239.90 ▲2.3935.36 ▼7.13
Add New Post /wp-admin/post-new.php1,548 ▲322.97 ▼0.03646.05 ▼15.0054.34 ▼0.97
Media Library /wp-admin/upload.php1,398 ▼24.11 ▼0.11103.67 ▲1.4945.41 ▼0.73
Script Optimizer /wp-admin/options-general.php?page=script-optimizer1,1121.6827.9331.87

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=script-optimizer
    • > Notice in wp-content/plugins/js-css-script-optimizer/backend.php+115
    Undefined index: enable-plugin

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/js-css-script-optimizer/js-css-script-optimizer.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function content_url() in wp-content/plugins/js-css-script-optimizer/js-css-script-optimizer.php:12
    • > PHP Warning
      Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/js-css-script-optimizer/js-css-script-optimizer.php on line 11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Screenshot #1 (YSlow speed test after installation) image missing
The official readme.txt is a good inspiration

js-css-script-optimizer/js-css-script-optimizer.php 92% from 13 tests

The principal PHP file in "JS & CSS Script Optimizer" v. 0.3.3 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 270 characters long)

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
Success! There were no dangerous files found in this plugin2,464 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP43645552,016
PO File3183192448

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity45.88
▷ Minimum class complexity1.00
▷ Maximum class complexity164.00
Average method complexity4.86
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods93
▷ Static methods4649.46%
▷ Public methods4649.46%
▷ Protected methods99.68%
▷ Private methods3840.86%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants17
▷ Global constants211.76%
▷ Class constants1588.24%
▷ Public constants15100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.57MB with 0.35MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png36.20KB14.93KB▼ 58.77%
screenshot-1.png69.51KB30.42KB▼ 56.24%
screenshot-5.png227.40KB66.97KB▼ 70.55%
screenshot-4.png204.60KB67.21KB▼ 67.15%
screenshot-3.png45.88KB19.70KB▼ 57.07%