94% autoptimize

Code Review | Autoptimize

WordPress plugin Autoptimize scored 94% from 54 tests.

About plugin

  • Plugin page: autoptimize
  • Plugin version: 2.9.5.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.9
  • WordPress version: 5.9.2
  • First release: Jul 9, 2009
  • Latest release: Feb 17, 2022
  • Number of updates: 446
  • Update frequency: every 10.3 days
  • Top authors: futtta (81.39%)turl (18.83%)

Code review

54 tests

User reviews

1319 reviews

Install metrics

1,000,000+ active / 26,063,788 total downloads

Benchmarks

Plugin footprint 99% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲1.25MB] [CPU: ▼276.17ms] 75% from 4 tests

A check of server-side resources used by Autoptimize
The following require your attention
  • CPU: Total CPU usage should be kept under 500.00ms (currently 509.99ms on /wp-admin/options-general.php?page=autoptimize)
PageMemory (MB)CPU Time (ms)
Home /4.56 ▲1.0469.08 ▲17.66
Dashboard /wp-admin4.75 ▲1.3566.91 ▲33.45
Posts /wp-admin/edit.php4.98 ▲1.3459.57 ▲23.33
Add New Post /wp-admin/post-new.php8.23 ▲1.26117.99 ▼1,156.08
Media Library /wp-admin/upload.php4.64 ▲1.3541.32 ▲10.40
autoptimize_imgopt /wp-admin/admin.php?page=autoptimize_imgopt4.6142.47
Critical CSS /wp-admin/admin.php?page=ao_critcss4.83276.87
autoptimize_extra /wp-admin/admin.php?page=autoptimize_extra4.6143.21
Autoptimize /wp-admin/options-general.php?page=autoptimize5.97509.99
AO partner /wp-admin/admin.php?page=ao_partners5.73261.61

Server storage [IO: ▲0.81MB] [DB: ▲0.08MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • You have illegally modified 5 files (3.41KB) outside of "wp-content/plugins/autoptimize/" and "wp-content/uploads/"
    • (new file) wp-content/cache/autoptimize/css/index.html
    • (new file) wp-content/autoptimize_404_handler.php
    • (new file) wp-content/cache/autoptimize/index.html
    • (new file) wp-content/cache/autoptimize/.htaccess
    • (new file) wp-content/cache/autoptimize/js/index.html
Filesystem: 76 new files
Database: no new tables, 4 new options
New WordPress options
autoptimize_imgopt_launched
autoptimize_ccss_version
autoptimize_service_availablity
autoptimize_version

Browser metrics Passed 4 tests

An overview of browser requirements for Autoptimize
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,019 ▲27516.36 ▲0.7310.80 ▲4.512.89 ▲0.72
Dashboard /wp-admin2,951 ▲906.22 ▲0.04123.67 ▼10.78156.67 ▼9.20
Posts /wp-admin/edit.php2,764 ▲703.27 ▲0.0565.49 ▲0.27143.83 ▲2.51
Add New Post /wp-admin/post-new.php1,910 ▲19922.86 ▲1.74423.78 ▼34.12173.18 ▲13.99
Media Library /wp-admin/upload.php1,771 ▲735.59 ▲0.05140.02 ▼6.71187.25 ▲6.71
autoptimize_imgopt /wp-admin/admin.php?page=autoptimize_imgopt1,3632.7256.16134.08
Critical CSS /wp-admin/admin.php?page=ao_critcss1,8413.2668.32202.52
autoptimize_extra /wp-admin/admin.php?page=autoptimize_extra1,3532.8857.84156.89
Autoptimize /wp-admin/options-general.php?page=autoptimize2,0813.4686.57152.97
AO partner /wp-admin/admin.php?page=ao_partners1,2512.7258.95120.63

Uninstaller [IO: ▲0.00MB] [DB: ▲0.08MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 7× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_queue.js.php on line 23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_create_nonce() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_impexp.js.php:12
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_debug.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_queue.js.php:71
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php:43
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
8 plugin tags: lazy-load, optimize, core web vitals, pagespeed, performance...

autoptimize/autoptimize.php Passed 13 tests

The principal PHP file in "Autoptimize" v. 2.9.5.1 is loaded by WordPress automatically on each request
76 characters long description:
Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin11,833 lines of code in 63 files:
LanguageFilesBlank linesComment linesLines of code
PHP441,8133,57910,826
CSS67122689
JavaScript104373230
Markdown131086
HTML2002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity56.63
▷ Minimum class complexity1.00
▷ Maximum class complexity256.00
Average method complexity5.64
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes35
▷ Abstract classes12.86%
▷ Concrete classes3497.14%
▷ Final classes00.00%
Methods423
▷ Static methods12228.84%
▷ Public methods32376.36%
▷ Protected methods5112.06%
▷ Private methods4911.58%
Functions17
▷ Named functions952.94%
▷ Anonymous functions847.06%
Constants48
▷ Global constants3266.67%
▷ Class constants1633.33%
▷ Public constants16100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
classes/external/do_not_donate_smallest.png9.36KB3.91KB▼ 58.24%