84% fastly

Code Review | Fastly

WordPress plugin Fastly scored84%from 54 tests.

About plugin

  • Plugin page: fastly
  • Plugin version: 1.2.24
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6.2-6.3.1
  • WordPress version: 6.3.1
  • First release: Jul 24, 2012
  • Latest release: Sep 6, 2023
  • Number of updates: 122
  • Update frequency: every 35.4 days
  • Top authors: fastly (100%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active /70,325 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼4.49ms] Passed 4 tests

This is a short check of server-side resources used by Fastly
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0545.20 ▲8.35
Dashboard /wp-admin3.40 ▲0.0549.77 ▼7.97
Posts /wp-admin/edit.php3.51 ▲0.1647.54 ▼0.89
Add New Post /wp-admin/post-new.php5.98 ▲0.0981.48 ▼11.78
Media Library /wp-admin/upload.php3.32 ▲0.0935.97 ▲2.70
Edge Modules /wp-admin/admin.php?page=fastly-edge-modules3.3235.01
Webhooks /wp-admin/admin.php?page=fastly-webhooks3.2827.53
General /wp-admin/admin.php?page=fastly3.2831.07
Image Optimization /wp-admin/admin.php?page=fastly-io3.2827.98
Advanced /wp-admin/admin.php?page=fastly-advanced3.2832.09

Server storage [IO: ▲0.90MB] [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: 54 new files
Database: no new tables, 9 new options
New WordPress options
fastly-settings-general
can_compress_scripts
fastly-settings-advanced
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
fastly-schema-version

Browser metrics Passed 4 tests

A check of browser resources used by Fastly
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,839 ▲9313.22 ▼1.181.78 ▲0.0143.60 ▲0.87
Dashboard /wp-admin2,245 ▲565.85 ▼0.0798.52 ▼4.3337.98 ▼5.52
Posts /wp-admin/edit.php2,131 ▲422.02 ▲0.0139.31 ▲1.1035.31 ▲3.13
Add New Post /wp-admin/post-new.php1,550 ▲3623.28 ▲5.61674.93 ▼6.0053.84 ▼13.93
Media Library /wp-admin/upload.php1,421 ▲304.22 ▲0.0195.55 ▼3.4641.43 ▼4.02
Edge Modules /wp-admin/admin.php?page=fastly-edge-modules7071.7110.7920.26
Webhooks /wp-admin/admin.php?page=fastly-webhooks9031.8525.3851.18
General /wp-admin/admin.php?page=fastly9512.0923.6033.25
Image Optimization /wp-admin/admin.php?page=fastly-io8082.0323.3326.46
Advanced /wp-admin/admin.php?page=fastly-advanced1,4811.8826.1339.17

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Zombie WordPress options were found after uninstall: 9 options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • fastly-settings-general
    • widget_recent-posts
    • theysaidso_admin_options
    • fastly-settings-advanced
    • fastly-schema-version

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
Please take a closer look at the following
  • 7× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/fastly/src/wp-cli.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/fastly/src/wp-purges.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/fastly/src/settings-page.php:50
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/fastly/purgely.php:164
    • > PHP Fatal error
      Uncaught Error: Class 'Purgely_Header' not found in wp-content/plugins/fastly/src/classes/header-surrogate-control.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Purgely_Header' not found in wp-content/plugins/fastly/src/classes/header-cache-control.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Purgely_Header' not found in wp-content/plugins/fastly/src/classes/header-surrogate-keys.php:8

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
10 plugin tags: dynamic, spike, fastly, performance, ddos...

fastly/purgely.php 92% from 13 tests

"Fastly" version 1.2.24's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("fastly.php" instead of "purgely.php")

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
Good job! No executable or dangerous file extensions detected8,926 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP187411,5244,332
JavaScript38204393,675
JSON1800898
Markdown12016
Bourne Shell1005

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity27.62
▷ Minimum class complexity2.00
▷ Maximum class complexity87.00
Average method complexity2.95
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes16.25%
▷ Concrete classes1593.75%
▷ Final classes00.00%
Methods217
▷ Static methods125.53%
▷ Public methods19288.48%
▷ Protected methods188.29%
▷ Private methods73.23%
Functions20
▷ Named functions1890.00%
▷ Anonymous functions210.00%
Constants46
▷ Global constants3167.39%
▷ Class constants1532.61%
▷ Public constants15100.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.36MB with 0.23MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-3.png82.12KB29.44KB▼ 64.15%
assets/screenshot-1.png110.16KB38.32KB▼ 65.22%
assets/screenshot-2.png177.01KB66.47KB▼ 62.45%