89% get-user-role

Code Review | Get User Role

WordPress plugin Get User Role scored89%from 54 tests.

About plugin

  • Plugin page: get-user-role
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.4
  • WordPress version: 6.3.1
  • First release: Nov 25, 2012
  • Latest release: Nov 25, 2012
  • Number of updates: 2
  • Update frequency: every 0.5 days
  • Top authors: theslink2000 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,307 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▲1.17ms] Passed 4 tests

This is a short check of server-side resources used by Get User Role
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.20 ▲0.04
Dashboard /wp-admin3.31 ▲0.0045.53 ▲0.70
Posts /wp-admin/edit.php3.36 ▲0.0047.71 ▲4.59
Add New Post /wp-admin/post-new.php5.89 ▲0.0099.10 ▲13.92
Media Library /wp-admin/upload.php3.23 ▲0.0032.48 ▼0.64

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Get User Role
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.13 ▼0.251.54 ▼0.2736.30 ▼6.14
Dashboard /wp-admin2,195 ▲275.63 ▲0.0593.28 ▲4.9436.94 ▼3.22
Posts /wp-admin/edit.php2,100 ▼01.98 ▲0.0339.23 ▲5.2335.53 ▼3.24
Add New Post /wp-admin/post-new.php1,526 ▼023.09 ▼0.10654.03 ▼53.4663.28 ▼0.53
Media Library /wp-admin/upload.php1,400 ▼34.15 ▼0.0695.60 ▲0.6140.73 ▼3.42

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
Looking good! No server-side errors or output on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
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 to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === get-user-role === )
You can take inspiration from this readme.txt

get-user-role/get_user_role.php 92% from 13 tests

"Get User Role" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("get-user-role.php" instead of "get_user_role.php")

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
No dangerous file extensions were detected33 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1102233

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.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