83% restrict-widgets

Code Review | Restrict Widgets

WordPress plugin Restrict Widgets scored83%from 54 tests.

About plugin

  • Plugin page: restrict-widgets
  • Plugin version: 1.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.7.1
  • WordPress version: 6.3.1
  • First release: Apr 7, 2013
  • Latest release: Jan 18, 2017
  • Number of updates: 55
  • Update frequency: every 25.1 days
  • Top authors: dfactory (100%)

Code review

54 tests

User reviews

36 reviews

Install metrics

8,000+ active /127,415 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.30MB] [CPU: ▼3.32ms] Passed 4 tests

A check of server-side resources used by Restrict Widgets
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.75 ▲0.2945.13 ▼3.11
Dashboard /wp-admin3.60 ▲0.3062.95 ▲5.89
Posts /wp-admin/edit.php3.72 ▲0.3653.70 ▲0.52
Add New Post /wp-admin/post-new.php6.19 ▲0.3090.03 ▼16.57
Media Library /wp-admin/upload.php3.54 ▲0.3146.02 ▲8.83
Restrict Widgets /wp-admin/options-general.php?page=restrict-widgets3.4836.23

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 59 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Restrict Widgets
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▼0.361.70 ▼0.4247.05 ▲0.13
Dashboard /wp-admin2,202 ▲255.63 ▲0.1089.03 ▼11.4938.96 ▼8.86
Posts /wp-admin/edit.php2,107 ▲72.00 ▼0.0136.09 ▼2.2837.25 ▲1.53
Add New Post /wp-admin/post-new.php1,531 ▲423.22 ▲0.13676.11 ▼7.5751.86 ▼1.30
Media Library /wp-admin/upload.php1,407 ▲44.29 ▲0.1098.79 ▼3.7543.07 ▼1.40
Restrict Widgets /wp-admin/options-general.php?page=restrict-widgets1,4002.4041.8939.51

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=restrict-widgets
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=restrict-widgets
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

SRP Passed 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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

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
These attributes need your attention:
  • Tags: There are too many tags (18 tag instead of maximum 10)
The official readme.txt might help

restrict-widgets/restrict-widgets.php 92% from 13 tests

The main file in "Restrict Widgets" v. 1.3.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Description: The description should be shorter than 140 characters (currently 143 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin1,802 lines of code in 53 files:
LanguageFilesBlank linesComment linesLines of code
PHP22862181,156
CSS2149441
PO File14142106
JavaScript48606299

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 143)
Cyclomatic complexity
Average complexity per logical line of code0.91
Average class complexity380.00
▷ Minimum class complexity380.00
▷ Maximum class complexity380.00
Average method complexity10.47
▷ Minimum method complexity1.00
▷ Maximum method complexity143.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes1100.00%
Methods40
▷ Static methods12.50%
▷ Public methods3485.00%
▷ Protected methods00.00%
▷ Private methods615.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants266.67%
▷ Class constants133.33%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
3 compressed PNG files occupy 0.00MB
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/chosen-sprite.png0.63KB0.88KB0.00%
images/chosen-sprite@2x.png0.85KB0.83KB▼ 3.10%
images/logo-dfactory.png2.92KB1.92KB▼ 34.20%