68% adminsanity

Code Review | AdminSanity

WordPress plugin AdminSanity scored68%from 54 tests.

About plugin

  • Plugin page: adminsanity
  • Plugin version: 1.2.8
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.0-6.1
  • WordPress version: 6.3.1
  • First release: Mar 15, 2021
  • Latest release: Nov 20, 2022
  • Number of updates: 5
  • Update frequency: every 123.6 days
  • Top authors: majick (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /779 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.31MB] [CPU: ▼27.91ms] Passed 4 tests

Analyzing server-side resources used by AdminSanity
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.05 ▲0.5945.17 ▲1.71
Dashboard /wp-admin3.64 ▲0.3328.78 ▼23.96
Posts /wp-admin/edit.php3.64 ▲0.2830.72 ▼15.86
Add New Post /wp-admin/post-new.php3.64 ▼2.2531.46 ▼66.95
Media Library /wp-admin/upload.php3.64 ▲0.4127.54 ▼4.88
AdminSanity /wp-admin/options-general.php?page=adminsanity3.6426.79

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 9 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
adminsanity_first_install
adminsanity
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by AdminSanity
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,015 ▲26913.78 ▼0.662.03 ▲0.2031.44 ▼11.81
Dashboard /wp-admin2,365 ▲1775.20 ▲0.30108.83 ▲1.4048.57 ▼0.33
Posts /wp-admin/edit.php2,260 ▲1712.42 ▲0.4346.38 ▲9.3643.25 ▲9.59
Add New Post /wp-admin/post-new.php1,631 ▲11217.92 ▼5.19621.08 ▼24.9349.62 ▼0.97
Media Library /wp-admin/upload.php1,555 ▲1644.36 ▲0.15104.20 ▼1.6046.10 ▲2.63
AdminSanity /wp-admin/options-general.php?page=adminsanity1,4894.23453.5047.21

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/adminsanity/adminsanity/adminsanity-menu.php+372
    Undefined index: c
  • Zombie WordPress options were found after uninstall: 8 options
    • adminsanity
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • adminsanity_first_install
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=adminsanity
    • > Notice in wp-content/plugins/adminsanity/adminsanity/adminsanity-menu.php+372
    Undefined index: c
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=adminsanity
    • > Warning in wp-content/plugins/adminsanity/adminsanity/adminsanity-menu.php+372
    in_array() expects parameter 2 to be array, null given

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 fix the following
  • 5× 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/adminsanity/adminsanity/adminsanity-menu.php:74
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/adminsanity/adminsanity.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/adminsanity/adminsanity/adminsanity-bar.php:63
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/adminsanity/adminsanity/adminsanity-notices.php:88
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/adminsanity/loader.php:3168

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 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: cleaner, admin menu, admin notices, wordpress admin, admin bar

adminsanity/loader.php 92% from 13 tests

The main PHP file in "AdminSanity" ver. 1.2.8 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("adminsanity.php" instead of "loader.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin3,797 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP58621,7333,797

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 129)
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity489.00
▷ Minimum class complexity489.00
▷ Maximum class complexity489.00
Average method complexity14.94
▷ Minimum method complexity1.00
▷ Maximum method complexity129.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods35
▷ Static methods00.00%
▷ Public methods35100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions47
▷ Named functions47100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.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
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/wpmedic.png4.65KB2.48KB▼ 46.68%
images/adminsanity.png8.59KB3.64KB▼ 57.64%