78% kneejerk-menu-swapper

Code Review | Kneejerk Menu Swapper

WordPress plugin Kneejerk Menu Swapper scored78%from 54 tests.

About plugin

  • Plugin page: kneejerk-menu-swa...
  • Plugin version: 1.1.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.8
  • WordPress version: 6.3.1
  • First release: Mar 9, 2020
  • Latest release: Sep 6, 2021
  • Number of updates: 10
  • Update frequency: every 57.8 days
  • Top authors: RedEarRyan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /534 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
Installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼8.52ms] Passed 4 tests

Server-side resources used by Kneejerk Menu Swapper
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0334.21 ▼6.81
Dashboard /wp-admin3.33 ▲0.0344.16 ▼6.82
Posts /wp-admin/edit.php3.39 ▲0.0347.32 ▼1.28
Add New Post /wp-admin/post-new.php5.92 ▲0.0382.23 ▼19.15
Media Library /wp-admin/upload.php3.26 ▲0.0337.14 ▲3.07

Server storage [IO: ▲0.15MB] [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: 15 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Kneejerk Menu Swapper
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲8013.29 ▼0.961.60 ▼0.3540.52 ▼10.36
Dashboard /wp-admin2,221 ▲304.93 ▼0.96110.08 ▲3.5882.87 ▲39.44
Posts /wp-admin/edit.php2,110 ▲211.97 ▼0.0239.24 ▼1.2433.84 ▼2.95
Add New Post /wp-admin/post-new.php1,527 ▼617.52 ▼5.73672.85 ▼0.6349.87 ▼0.42
Media Library /wp-admin/upload.php1,406 ▲154.24 ▲0.0298.84 ▼1.8278.16 ▲36.86

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% 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)
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/kneejerk-menu-swapper/templates/config.php
    • > /wp-content/plugins/kneejerk-menu-swapper/templates/about.php
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant KJD_MENU_SWAPPER_URI - assumed 'KJD_MENU_SWAPPER_URI' (this will throw an Error in a future version of PHP) in wp-content/plugins/kneejerk-menu-swapper/templates/about.php on line 38
    • > PHP Warning
      Use of undefined constant KJD_MENU_SWAPPER_URI - assumed 'KJD_MENU_SWAPPER_URI' (this will throw an Error in a future version of PHP) in wp-content/plugins/kneejerk-menu-swapper/templates/about.php on line 46
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/kneejerk-menu-swapper/templates/admin-menu.php:16
    • > PHP Warning
      Use of undefined constant KJD_MENU_SWAPPER_URI - assumed 'KJD_MENU_SWAPPER_URI' (this will throw an Error in a future version of PHP) in wp-content/plugins/kneejerk-menu-swapper/templates/about.php on line 42
    • > PHP Warning
      Use of undefined constant KJD_MENU_SWAPPER_URI - assumed 'KJD_MENU_SWAPPER_URI' (this will throw an Error in a future version of PHP) in wp-content/plugins/kneejerk-menu-swapper/templates/about.php on line 33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Kneejerk\\MenuSwapper\\plugin_dir_url() in wp-content/plugins/kneejerk-menu-swapper/index.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Donate link: Invalid url: "coming soon?"
You can take inspiration from this readme.txt

kneejerk-menu-swapper/index.php 92% from 13 tests

The principal PHP file in "Kneejerk Menu Swapper" v. 1.1.0 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("kneejerk-menu-swapper.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin381 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP53541329
Markdown116032
SVG10020

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity7.00
▷ Minimum class complexity7.00
▷ Maximum class complexity7.00
Average method complexity2.20
▷ Minimum method complexity2.00
▷ Maximum method complexity3.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 PNG files occupy 0.12MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/twenty_twenty_save.png2.35KB1.22KB▼ 47.94%
images/color_logo.png82.99KB34.14KB▼ 58.86%
images/twenty_twenty_menu_select.png4.38KB2.09KB▼ 52.28%
images/wp_logo.png1.22KB0.74KB▼ 39.63%
images/twenty_twenty_configure_enable.png14.81KB6.82KB▼ 53.98%