99% user-role-field-setting-for-acf

Code Review | ACF User Role Field Setting

WordPress plugin ACF User Role Field Setting scored 99% from 54 tests.

About plugin

  • Plugin page: user-role-field-s...
  • Plugin version: 3.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.7
  • WordPress version: 5.8.1
  • First release: Dec 31, 2016
  • Latest release: Apr 4, 2021
  • Number of updates: 27
  • Update frequency: every 57.5 days
  • Top authors: Hube2 (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

3,000+ active / 21,212 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

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

Analyzing server-side resources used by ACF User Role Field Setting
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.1436.37 ▲16.25
Dashboard /wp-admin3.08 ▲0.0349.94 ▼2.21
Posts /wp-admin/edit.php3.13 ▲0.0249.92 ▲2.64
Add New Post /wp-admin/post-new.php5.44 ▲0.01103.12 ▼549.19
Media Library /wp-admin/upload.php3.02 ▲0.0234.41 ▼7.33

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 4 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

ACF User Role Field Setting: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,679 ▲8315.97 ▲0.3812.04 ▲2.1347.80 ▲0.18
Dashboard /wp-admin2,970 ▲335.91 ▼0.09148.54 ▼5.86113.77 ▼5.04
Posts /wp-admin/edit.php2,739 ▼02.72 ▲0.0263.63 ▼4.6589.44 ▼0.52
Add New Post /wp-admin/post-new.php1,615 ▼6821.74 ▲2.94329.35 ▼53.98111.92 ▼8.11
Media Library /wp-admin/upload.php1,810 ▲625.03 ▲0.02144.45 ▼17.11115.62 ▼7.84

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Looking good! No server-side errors or output on direct access of PHP files

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)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Screenshot #1 (Field setting on example field) image not found
Please take inspiration from this readme.txt

user-role-field-setting-for-acf/acf-user-role-field-setting.php 92% from 13 tests

This is the main PHP file of "ACF User Role Field Setting" version 3.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("user-role-field-setting-for-acf.php" instead of "acf-user-role-field-setting.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin148 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP11720137
JSON10011

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.70
Average class complexity32.00
▷ Minimum class complexity32.00
▷ Maximum class complexity32.00
Average method complexity4.10
▷ 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 methods660.00%
▷ Protected methods00.00%
▷ Private methods440.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png13.23KB10.97KB▼ 17.10%