78% gp-hide-menu-options-by-role

Code Review | GP hide menu options by role

WordPress plugin GP hide menu options by role scored78%from 54 tests.

About plugin

  • Plugin page: gp-hide-menu-opti...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.3
  • WordPress version: 6.3.1
  • First release: Dec 1, 2015
  • Latest release: Nov 27, 2015
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: renemanqueros (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,439 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

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

This is a short check of server-side resources used by GP hide menu options by role
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0240.20 ▼0.06
Dashboard /wp-admin3.33 ▲0.0249.26 ▲2.10
Posts /wp-admin/edit.php3.38 ▲0.0248.63 ▼7.42
Add New Post /wp-admin/post-new.php5.91 ▲0.0288.17 ▼1.11
Media Library /wp-admin/upload.php3.25 ▲0.0233.44 ▼2.51
GP Hide Menu Options by Role /wp-admin/options-general.php?page=gp-hide-menu-options-by-role-admin3.2036.90

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for GP hide menu options by role
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.20 ▼1.181.71 ▼0.4344.23 ▼0.30
Dashboard /wp-admin2,213 ▲285.90 ▼0.04101.08 ▼13.6742.27 ▼0.60
Posts /wp-admin/edit.php2,093 ▲12.00 ▲0.0235.31 ▼1.5732.60 ▼0.93
Add New Post /wp-admin/post-new.php1,517 ▼1717.67 ▼5.54699.77 ▲23.2260.03 ▲10.52
Media Library /wp-admin/upload.php1,386 ▲44.19 ▼0.0097.94 ▼2.2141.49 ▼0.19
GP Hide Menu Options by Role /wp-admin/options-general.php?page=gp-hide-menu-options-by-role-admin8871.6828.2026.34

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=gp-hide-menu-options-by-role-admin
    • > Notice in wp-content/plugins/gp-hide-menu-options-by-role/index.php+96
    Trying to access array offset on value of type bool

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
Please take a closer look at the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gp-hide-menu-options-by-role/index.php:33

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

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
4 plugin tags: role, admin, hide, menu

gp-hide-menu-options-by-role/index.php 92% from 13 tests

The primary PHP file in "GP hide menu options by role" version 1.0.0 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("gp-hide-menu-options-by-role.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected117 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP12410117

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity7.00
▷ Minimum class complexity7.00
▷ Maximum class complexity7.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.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
No PNG files were detected