10% optimize-javascript

Code Review | Minify Javascript

WordPress plugin Minify Javascript scored 10% from 54 tests.

About plugin

  • Plugin page: optimize-javascript
  • Plugin version: 3.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-4.9
  • WordPress version: 6.3.1
  • First release: Mar 7, 2017
  • Latest release: Jan 2, 2018
  • Number of updates: 150
  • Update frequency: every 2.0 days
  • Top authors: peterpfeiffer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 11,963 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/optimize-javascript/includes/pfeiffersms-admin-bar.php+39
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.24MB] [CPU: ▼4.60ms] Passed 4 tests

A check of server-side resources used by Minify Javascript
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2132.67 ▼9.46
Dashboard /wp-admin3.55 ▲0.2446.48 ▼2.78
Posts /wp-admin/edit.php3.66 ▲0.3047.04 ▲0.54
Add New Post /wp-admin/post-new.php6.15 ▲0.2684.63 ▼6.69
Media Library /wp-admin/upload.php3.47 ▲0.2441.80 ▲7.03
Minify Javascript /wp-admin/options-general.php?page=optimize-javascript3.41243.01

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 36 new files
Database: no new tables, 9 new options
New WordPress options
pfeiffersms_plugin_version
db_upgraded
widget_recent-comments
widget_theysaidso_widget
pfeiffersms_options
pfeiffersms_notice
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Minify Javascript
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲9413.21 ▼0.962.50 ▲0.7442.88 ▲2.72
Dashboard /wp-admin2,220 ▲325.84 ▼0.0696.61 ▼7.2140.92 ▼0.51
Posts /wp-admin/edit.php2,105 ▲162.03 ▼0.0133.71 ▼6.9730.02 ▼6.78
Add New Post /wp-admin/post-new.php1,525 ▼823.17 ▲0.08647.72 ▼11.1956.45 ▼2.07
Media Library /wp-admin/upload.php1,393 ▲54.25 ▲0.06108.84 ▼3.4847.44 ▲0.99
Minify Javascript /wp-admin/options-general.php?page=optimize-javascript1,1102.0825.9526.70

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=optimize-javascript
    • > Deprecated in wp-content/plugins/optimize-javascript/includes/pfeiffersms-admin.php+623
    join(): Passing glue string after array is deprecated. Swap the parameters

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/optimize-javascript/includes/pfeiffersms-config.php on line 11
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/optimize-javascript/includes/pfeiffersms-config.php on line 12
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/optimize-javascript/includes/minifier/JShrink/Minifier.php on line 227
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/optimize-javascript/includes/pfeiffersms-config.php on line 11
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/optimize-javascript/includes/pfeiffersms-config.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Minify' not found in wp-content/plugins/optimize-javascript/includes/minifier/minify/src/CSS.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Exceptions\\BasicException' not found in wp-content/plugins/optimize-javascript/includes/minifier/minify/src/Exceptions/IOException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Exception' not found in wp-content/plugins/optimize-javascript/includes/minifier/minify/src/Exceptions/BasicException.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/optimize-javascript/includes/pfeiffersms-admin.php:77
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Minify' not found in wp-content/plugins/optimize-javascript/includes/minifier/minify/src/JS.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • License uri: Invalid URI ("")
Please take inspiration from this readme.txt

optimize-javascript/pfeiffers-merge-scripts.php 92% from 13 tests

"Minify Javascript" version 3.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("optimize-javascript.php" instead of "pfeiffers-merge-scripts.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
It is important to fix the following items
  • Do not distribute dangerous files with your plugin
    • .jar - Java Archive in Firefox, IE, Chrome, Safari
      • wp-content/plugins/optimize-javascript/includes/minifier/yuicompressor/yuicompressor.jar
2,560 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP196461,4342,201
CSS180214
JavaScript31514107
Markdown121038

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity24.64
▷ Minimum class complexity1.00
▷ Maximum class complexity103.00
Average method complexity3.98
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes14
▷ Abstract classes428.57%
▷ Concrete classes1071.43%
▷ Final classes00.00%
Methods116
▷ Static methods21.72%
▷ Public methods6354.31%
▷ Protected methods4437.93%
▷ Private methods97.76%
Functions5
▷ Named functions00.00%
▷ Anonymous functions5100.00%
Constants10
▷ Global constants990.00%
▷ Class constants110.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected