84% nav-menu-roles

Code Review | Nav Menu Roles

WordPress plugin Nav Menu Roles scored84%from 54 tests.

About plugin

  • Plugin page: nav-menu-roles
  • Plugin version: 2.1.2
  • PHP compatiblity: 5.3.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-6.1.0
  • WordPress version: 6.3.1
  • First release: Sep 20, 2012
  • Latest release: Jan 7, 2023
  • Number of updates: 117
  • Update frequency: every 32.2 days
  • Top authors: helgatheviking (83.76%)deployer (17.09%)

Code review

54 tests

User reviews

214 reviews

Install metrics

100,000+ active /1,641,588 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.11MB] [CPU: ▼5.30ms] Passed 4 tests

Analyzing server-side resources used by Nav Menu Roles
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1239.23 ▼7.42
Dashboard /wp-admin3.42 ▲0.1146.77 ▼1.83
Posts /wp-admin/edit.php3.53 ▲0.1745.80 ▼3.08
Add New Post /wp-admin/post-new.php6.00 ▲0.1181.15 ▼8.86
Media Library /wp-admin/upload.php3.34 ▲0.1135.41 ▲1.99

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Nav Menu Roles
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲2814.28 ▼0.071.79 ▼0.0838.13 ▼3.84
Dashboard /wp-admin2,192 ▲155.56 ▼0.0280.35 ▼7.2837.58 ▼2.00
Posts /wp-admin/edit.php2,100 ▲32.02 ▲0.0333.28 ▼1.5835.61 ▼0.30
Add New Post /wp-admin/post-new.php1,535 ▲418.26 ▼4.76609.80 ▼53.7763.71 ▲7.68
Media Library /wp-admin/upload.php1,400 ▼34.17 ▼0.0595.02 ▼6.3342.16 ▼2.11

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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 fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu' not found in wp-content/plugins/nav-menu-roles/inc/class-walker-nav-menu-edit-roles-4.5.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu_Edit' not found in wp-content/plugins/nav-menu-roles/inc/class-walker-nav-menu-edit-roles-4.7.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Customize_Nav_Menu_Roles\\add_action() in wp-content/plugins/nav-menu-roles/inc/customizer.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
4 plugin tags: nav menus, menu, nav menu, menus

nav-menu-roles/nav-menu-roles.php Passed 13 tests

"Nav Menu Roles" version 2.1.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
43 characters long description:
Hide custom menu items 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
There were no executable files found in this plugin1,265 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP92726091,029
PO File288110234
JavaScript2002

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity24.80
▷ Minimum class complexity1.00
▷ Maximum class complexity63.00
Average method complexity3.70
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods44
▷ Static methods24.55%
▷ Public methods4397.73%
▷ Protected methods12.27%
▷ Private methods00.00%
Functions11
▷ Named functions981.82%
▷ Anonymous functions218.18%
Constants3
▷ Global constants133.33%
▷ Class constants266.67%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected