94% widget-context

Code Review | Widget Context

WordPress plugin Widget Context scored 94% from 54 tests.

About plugin

  • Plugin page: widget-context
  • Plugin version: 1.3.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.7
  • WordPress version: 5.8.1
  • First release: Jul 16, 2009
  • Latest release: May 7, 2021
  • Number of updates: 116
  • Update frequency: every 38.2 days
  • Top authors: kasparsd (94.83%)jamescollins (6.03%)

Code review

54 tests

User reviews

93 reviews

Install metrics

80,000+ active / 823,207 total downloads

Benchmarks

Plugin footprint Passed 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.27MB] [CPU: ▼143.63ms] Passed 4 tests

An overview of server-side resources used by Widget Context
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.08 ▲0.3630.60 ▲8.89
Dashboard /wp-admin3.37 ▲0.3147.92 ▼4.71
Posts /wp-admin/edit.php3.42 ▲0.3149.45 ▲2.41
Add New Post /wp-admin/post-new.php5.67 ▲0.2497.56 ▼561.36
Media Library /wp-admin/upload.php3.25 ▲0.2432.38 ▼10.84
Widget Context /wp-admin/themes.php?page=widget_context_settings3.2232.58

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 25 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Widget Context
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,694 ▲10015.82 ▲0.276.74 ▼2.5547.02 ▼6.03
Dashboard /wp-admin2,975 ▲415.88 ▼0.04135.08 ▼45.35118.99 ▼6.70
Posts /wp-admin/edit.php2,744 ▲52.69 ▼0.0168.05 ▼9.8485.76 ▼24.03
Add New Post /wp-admin/post-new.php1,686 ▲18618.74 ▲0.13369.50 ▲6.42102.91 ▼7.73
Media Library /wp-admin/upload.php1,812 ▲55.01 ▼0.01162.25 ▲15.24116.78 ▼3.84
Widget Context /wp-admin/themes.php?page=widget_context_settings1,3792.3658.0195.88

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
This plugin's uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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 fix the following
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Preseto\\WidgetContext\\wp_upload_dir() in wp-content/plugins/widget-context/src/Plugin.php:41

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

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
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (Widget Context settings at the bottom of every widget), #2 (Widget Context plugin settings)
You can look at the official readme.txt

widget-context/widget-context.php 92% from 13 tests

"Widget Context" version 1.3.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 155 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,546 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP144035581,427
JSON20064
CSS117340
JavaScript14115

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity20.89
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity2.79
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods104
▷ Static methods43.85%
▷ Public methods9894.23%
▷ Protected methods54.81%
▷ Private methods10.96%
Functions5
▷ Named functions120.00%
▷ Anonymous functions480.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.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
2 compressed PNG files occupy 0.09MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png43.02KB45.60KB0.00%
screenshot-1.png48.71KB51.17KB0.00%