88% add-user-role

Code Review | Add User Role

WordPress plugin Add User Role scored 88% from 54 tests.

About plugin

  • Plugin page: add-user-role
  • Plugin version: 0.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 0.0.1-4.0
  • WordPress version: 5.9.2
  • First release: Oct 10, 2014
  • Latest release: Oct 10, 2014
  • Number of updates: 19
  • Update frequency: N/A
  • Top authors: nikhilvaghela (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

100+ active / 4,329 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼290.89ms] Passed 4 tests

A check of server-side resources used by Add User Role
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0451.90 ▼1.75
Dashboard /wp-admin3.45 ▲0.0534.23 ▼3.72
Posts /wp-admin/edit.php3.68 ▲0.0437.29 ▲0.19
Add New Post /wp-admin/post-new.php6.92 ▼0.0593.11 ▼1,156.29
Media Library /wp-admin/upload.php3.33 ▲0.0323.91 ▼1.79
My Role /wp-admin/users.php?page=my-unique-identifier3.3022.72

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 18 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Add User Role: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,801 ▲7916.31 ▲0.767.04 ▲1.332.43 ▼0.15
Dashboard /wp-admin2,930 ▲757.03 ▲0.86119.21 ▼11.78173.15 ▼3.26
Posts /wp-admin/edit.php2,732 ▲443.32 ▲0.0971.95 ▲6.53156.98 ▲18.53
Add New Post /wp-admin/post-new.php1,689 ▲2916.52 ▼0.49410.91 ▼2.20188.90 ▲34.23
Media Library /wp-admin/upload.php1,736 ▲386.01 ▲0.49128.44 ▼7.96198.74 ▲4.93
My Role /wp-admin/users.php?page=my-unique-identifier1,3843.7775.48143.44

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 50% from 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 50% from 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
Please take a closer look at the following
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-user-role/ajax/ajax.php:8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please fix the following browser errors
    • > GET request to /wp-admin/users.php?page=my-unique-identifier
    • > Network (severe)
    wp-content/plugins/add-user-role/css/images/ui-bg_flat_75_ffffff_40x100.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
9 plugin tags: editor, user roll, user role, colon, admin...

add-user-role/userrole.php 92% from 13 tests

Analyzing the main PHP file in "Add User Role" version 0.0.1
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("add-user-role.php" instead of "userrole.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
There were no executable files found in this plugin2,554 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
CSS241511,185
JavaScript21501091,108
PHP24011261

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity1.80
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods6
▷ Static methods00.00%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
11 PNG files occupy 0.07MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/text-box.png0.25KB0.24KB▼ 4.31%
css/images/ui-bg_flat_0_aaaaaa_40x100.png0.25KB0.08KB▼ 65.34%
css/images/ui-icons_222222_256x240.png6.84KB4.18KB▼ 38.88%
screenshot-1.png44.40KB15.98KB▼ 64.02%
css/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.31KB0.18KB▼ 42.95%