89% wp-user-role-switcher

Code Review | User Role Switcher

WordPress plugin User Role Switcher scored89%from 54 tests.

About plugin

  • Plugin page: wp-user-role-swit...
  • Plugin version: 0.2.0
  • PHP compatiblity: 5.3.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-5.6.2
  • WordPress version: 6.3.1
  • First release: Feb 25, 2020
  • Latest release: Mar 26, 2021
  • Number of updates: 13
  • Update frequency: every 92.2 days
  • Top authors: dhanendran (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /1,884 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.04MB] [CPU: ▼4.76ms] Passed 4 tests

This is a short check of server-side resources used by User Role Switcher
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0641.58 ▲1.60
Dashboard /wp-admin3.35 ▲0.0146.80 ▼13.70
Posts /wp-admin/edit.php3.40 ▲0.0550.92 ▼0.33
Add New Post /wp-admin/post-new.php5.93 ▲0.0592.47 ▼4.05
Media Library /wp-admin/upload.php3.28 ▲0.0534.60 ▼0.97

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

User Role Switcher: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,842 ▲8114.38 ▲0.021.72 ▲0.1546.26 ▲5.28
Dashboard /wp-admin2,223 ▲465.60 ▼0.0695.78 ▲9.4740.02 ▼3.46
Posts /wp-admin/edit.php2,128 ▲282.03 ▲0.0338.63 ▲1.9936.50 ▲0.12
Add New Post /wp-admin/post-new.php1,548 ▲1723.10 ▼0.23657.92 ▲48.8954.63 ▲6.69
Media Library /wp-admin/upload.php1,431 ▲284.25 ▼0.05100.66 ▲4.7745.58 ▲2.89

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
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts

Smoke tests Passed 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 Passed 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The SRP test was a success

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • License uri: Please fix this invalid URI: "http://www.gnu.org/licenses/gpl-3.0.html"
You can look at the official readme.txt

wp-user-role-switcher/wp-user-role-switcher.php 85% from 13 tests

The main PHP file in "User Role Switcher" ver. 0.2.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 360 characters long)
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

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
Success! There were no dangerous files found in this plugin308 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP13567198
CSS115182
Markdown115028

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity27.00
▷ Minimum class complexity27.00
▷ Maximum class complexity27.00
Average method complexity3.60
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods770.00%
▷ Protected methods00.00%
▷ Private methods330.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants0
▷ Global constants00.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
There are no PNG files in this plugin