77% psn-pagespeed-ninja

Code Review | PageSpeed Ninja

WordPress plugin PageSpeed Ninja scored77%from 54 tests.

About plugin

  • Plugin page: psn-pagespeed-ninja
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 30, 2017
  • Latest release: Dec 1, 2023
  • Number of updates: 135
  • Update frequency: every 16.9 days
  • Top authors: pagespeed (100%)

Code review

54 tests

User reviews

110 reviews

Install metrics

10,000+ active /536,096 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.43MB] [CPU: ▼6.97ms] Passed 4 tests

Server-side resources used by PageSpeed Ninja
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2535.73 ▼5.91
Dashboard /wp-admin3.85 ▲0.5150.18 ▼10.68
Posts /wp-admin/edit.php3.90 ▲0.5552.79 ▲7.69
Add New Post /wp-admin/post-new.php6.37 ▲0.4886.48 ▼11.30
Media Library /wp-admin/upload.php3.71 ▲0.4835.83 ▲0.01
General /wp-admin/admin.php?page=pagespeedninja4.2138.83
Advanced /wp-admin/admin.php?page=pagespeedninja_advanced4.2139.23
Upgrade to Pro /wp-admin/admin.php?page=javascript:void(0)3.5828.75

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

Filesystem and database footprint
Please try to fix the following items
  • Illegal file modification found: 1 file (0.00KB) outside of "wp-content/plugins/psn-pagespeed-ninja/" and "wp-content/uploads/"
    • (new file) s/.empty
Filesystem: 219 new files
Database: 1 new table, 7 new options
New tables
wp_psninja_urls
New WordPress options
db_upgraded
theysaidso_admin_options
pagespeedninja_config
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

PageSpeed Ninja: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,877 ▲11514.20 ▼0.511.71 ▲0.0438.49 ▼4.41
Dashboard /wp-admin2,282 ▲1075.68 ▼0.0396.78 ▼17.7544.12 ▼0.94
Posts /wp-admin/edit.php2,191 ▲912.15 ▲0.2242.15 ▲4.0736.84 ▲0.53
Add New Post /wp-admin/post-new.php1,582 ▲5623.08 ▼0.14588.18 ▼16.3062.23 ▲20.83
Media Library /wp-admin/upload.php1,481 ▲814.21 ▲0.03104.08 ▲8.1242.67 ▼1.37
General /wp-admin/admin.php?page=pagespeedninja1,0872.0041.7188.92
Advanced /wp-admin/admin.php?page=pagespeedninja_advanced1,0641.9937.0045.06
Upgrade to Pro /wp-admin/admin.php?page=javascript:void(0)280.410.083.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/psn-pagespeed-ninja/admin/partials/pagespeedninja-survey-form.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Ressio_DeviceDetector_Base' not found in wp-content/plugins/psn-pagespeed-ninja/public/ress/wpdevicedetector.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/psn-pagespeed-ninja/includes/options.json.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/psn-pagespeed-ninja/includes/presets.json.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=javascript:void(0)
    • > Network (severe)
    wp-admin/admin.php?page=javascript:void(0) - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

psn-pagespeed-ninja/pagespeedninja.php 92% from 13 tests

"PageSpeed Ninja" version 1.1.1'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: It is recommended to name the main PHP file as the plugin slug ("psn-pagespeed-ninja.php" instead of "pagespeedninja.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected23,253 lines of code in 200 files:
LanguageFilesBlank linesComment linesLines of code
PHP1522,9487,36819,070
JavaScript255754892,893
CSS4107241,076
JSON1300134
Markdown125072
HTML4007
SVG1001

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 245)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity22.57
▷ Minimum class complexity1.00
▷ Maximum class complexity287.00
Average method complexity4.98
▷ Minimum method complexity1.00
▷ Maximum method complexity245.00
Code structure
Namespaces0
Interfaces28
Traits0
Classes131
▷ Abstract classes86.11%
▷ Concrete classes12393.89%
▷ Final classes21.63%
Methods1,013
▷ Static methods323.16%
▷ Public methods73172.16%
▷ Protected methods23923.59%
▷ Private methods434.24%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants82
▷ Global constants89.76%
▷ Class constants7490.24%
▷ Public constants74100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/image/icons.png0.14KB0.13KB▼ 6.21%
assets/image/ninja.png2.05KB1.40KB▼ 31.47%
assets/image/arrow.png0.49KB0.40KB▼ 17.71%
assets/image/pagespeed-ninja-logo.png17.25KB8.63KB▼ 49.96%