90% lh-add-roles-to-body-class

Code Review | LH Add Roles to Body Class

WordPress plugin LH Add Roles to Body Class scored90%from 54 tests.

About plugin

  • Plugin page: lh-add-roles-to-b...
  • Plugin version: 1.01
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0
  • WordPress version: 6.3.1
  • First release: May 24, 2018
  • Latest release: Jul 29, 2022
  • Number of updates: 5
  • Update frequency: every 305.4 days
  • Top authors: shawfactor (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /737 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼8.01MB] [CPU: ▼1,641,315.08ms] Passed 4 tests

This is a short check of server-side resources used by LH Add Roles to Body Class
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0148.66 ▲7.69
Dashboard /wp-admin3.36 ▼32.0652.38 ▼6,565,252.37
Posts /wp-admin/edit.php3.41 ▲0.0149.66 ▼3.18
Add New Post /wp-admin/post-new.php5.94 ▲0.0192.26 ▼5.81
Media Library /wp-admin/upload.php3.28 ▲0.0138.25 ▲1.03

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for LH Add Roles to Body Class
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.25 ▼0.101.82 ▲0.1244.14 ▲1.51
Dashboard /wp-admin2,192 ▲145.52 ▼0.2297.21 ▼10.2042.41 ▼1.71
Posts /wp-admin/edit.php2,100 ▼02.02 ▲0.0138.45 ▲0.3636.17 ▲0.41
Add New Post /wp-admin/post-new.php1,526 ▼223.16 ▼0.02665.62 ▼51.8557.10 ▼2.05
Media Library /wp-admin/upload.php1,394 ▼34.23 ▲0.1199.78 ▼2.4947.21 ▼1.97

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, 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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: body, html, role, class, tag

lh-add-roles-to-body-class/lh-add-roles-to-body-class.php Passed 13 tests

This is the main PHP file of "LH Add Roles to Body Class" version 1.01, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
100 characters long description:
Simply adds the currently logged in users roles as classes to the body tag in the front and back end

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected46 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP2531646

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity6.00
▷ Minimum class complexity6.00
▷ Maximum class complexity6.00
Average method complexity1.83
▷ 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 methods233.33%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.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
There are no PNG files in this plugin