68% adminsanity

Code Review | AdminSanity

WordPress plugin AdminSanity scored 68% from 54 tests.

About plugin

  • Plugin page: adminsanity
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.0-5.8
  • WordPress version: 5.9.2
  • First release: Mar 15, 2021
  • Latest release: Jan 16, 2022
  • Number of updates: 3
  • Update frequency: every 103.3 days
  • Top authors: majick (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 307 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.68MB] [CPU: ▼322.69ms] Passed 4 tests

A check of server-side resources used by AdminSanity
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.13 ▲0.6158.24 ▼2.30
Dashboard /wp-admin3.65 ▲0.2423.11 ▼11.38
Posts /wp-admin/edit.php3.65 ▲0.0120.62 ▼16.59
Add New Post /wp-admin/post-new.php3.65 ▼3.3220.04 ▼1,257.59
Media Library /wp-admin/upload.php3.65 ▲0.3519.12 ▼5.19
AdminSanity /wp-admin/options-general.php?page=adminsanity3.6520.54

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 9 new files
Database: no new tables, 2 new options
New WordPress options
adminsanity
adminsanity_first_install

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 /4,057 ▲30316.38 ▲0.806.00 ▲0.242.15 ▼0.47
Dashboard /wp-admin3,134 ▲2736.48 ▲0.30120.26 ▼24.08198.07 ▲28.76
Posts /wp-admin/edit.php2,931 ▲2403.30 ▲0.0677.76 ▲14.25188.21 ▲41.68
Add New Post /wp-admin/post-new.php1,847 ▲9516.52 ▼4.38428.64 ▼25.12154.57 ▲2.23
Media Library /wp-admin/upload.php1,939 ▲2415.75 ▲0.21143.26 ▲0.12220.04 ▲31.86
AdminSanity /wp-admin/options-general.php?page=adminsanity1,9664.19387.47203.85

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/adminsanity/adminsanity/adminsanity-menu.php+371
    Undefined index: c
  • This plugin does not fully uninstall, leaving 2 options in the database
    • adminsanity
    • adminsanity_first_install

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 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+371
    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+371
    in_array() expects parameter 2 to be array, null given

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > 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 plugins_url() in wp-content/plugins/adminsanity/adminsanity.php:18
    • > 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:2911
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/adminsanity/adminsanity/adminsanity-menu.php:74

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: admin menu, cleaner, wordpress admin, admin notices, admin bar

adminsanity/adminsanity.php Passed 13 tests

"AdminSanity" version 1.0.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
45 characters long description:
Add Sanity back to your WordPress Admin Area.

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected3,689 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP58201,5613,689

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 118)
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity467.00
▷ Minimum class complexity467.00
▷ Maximum class complexity467.00
Average method complexity15.12
▷ Minimum method complexity1.00
▷ Maximum method complexity118.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods33
▷ Static methods00.00%
▷ Public methods33100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions46
▷ Named functions46100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.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
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%