94% role-content-restriction

Code Review | Role Content Restriction

WordPress plugin Role Content Restriction scored 94% from 54 tests.

About plugin

  • Plugin page: role-content-rest...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.6
  • WordPress version: 5.8.1
  • First release: Feb 4, 2016
  • Latest release: Aug 18, 2016
  • Number of updates: 6
  • Update frequency: every 32.8 days
  • Top authors: Imprevo (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active / 1,248 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

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

This is a short check of server-side resources used by Role Content Restriction
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.88 ▲0.0438.79 ▲2.80
Dashboard /wp-admin3.10 ▲0.0544.58 ▼4.36
Posts /wp-admin/edit.php3.15 ▲0.0444.91 ▲6.09
Add New Post /wp-admin/post-new.php5.47 ▲0.04104.95 ▼610.36
Media Library /wp-admin/upload.php3.04 ▲0.0337.60 ▼2.99

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 5 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Role Content Restriction
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,679 ▲8316.22 ▲0.6711.19 ▼2.2248.78 ▼13.90
Dashboard /wp-admin2,970 ▲396.02 ▲0.09150.00 ▼9.98111.98 ▲2.71
Posts /wp-admin/edit.php2,739 ▼02.72 ▲0.0168.88 ▼1.9596.77 ▲5.02
Add New Post /wp-admin/post-new.php1,739 ▼1,90618.25 ▼0.41399.13 ▼106.66115.41 ▲3.59
Media Library /wp-admin/upload.php1,807 ▼05.03 ▲0.02156.22 ▼6.14116.94 ▼12.31

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
This plugin's uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
Almost there! Just fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/role-content-restriction/role-content-restriction.php:20

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 on the user side

Optimizations

Plugin configuration 97% 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
Attributes that need to be fixed: You can look at the official readme.txt

role-content-restriction/role-content-restriction.php Passed 13 tests

The entry point to "Role Content Restriction" version 1.0.0 is a PHP file that has certain tags in its header comment area
60 characters long description:
Restricts access to selected post types based on user roles.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected184 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP268140154
PO File15530

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity28.00
▷ Minimum class complexity28.00
▷ Maximum class complexity28.00
Average method complexity4.00
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods777.78%
▷ Protected methods00.00%
▷ Private methods222.22%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
PNG images were not found in this plugin