84% nav-menu-collapse

Code Review | Nav Menu Collapse

WordPress plugin Nav Menu Collapse scored84%from 54 tests.

About plugin

  • Plugin page: nav-menu-collapse
  • Plugin version: 2.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Feb 16, 2018
  • Latest release: Mar 23, 2023
  • Number of updates: 47
  • Update frequency: every 39.6 days
  • Top authors: rnoakes3rd (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

3,000+ active /34,393 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
Install script ran successfully

Server metrics [RAM: ▲0.15MB] [CPU: ▼2.16ms] Passed 4 tests

Server-side resources used by Nav Menu Collapse
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1341.71 ▼8.88
Dashboard /wp-admin3.46 ▲0.1554.31 ▲3.33
Posts /wp-admin/edit.php3.57 ▲0.2250.08 ▼0.25
Add New Post /wp-admin/post-new.php6.04 ▲0.1588.57 ▼2.84
Media Library /wp-admin/upload.php3.38 ▲0.1540.69 ▲3.55
Nav Menu Collapse /wp-admin/options-general.php?page=nav_menu_collapse_settings3.5636.57

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 44 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
nav_menu_collapse_version
db_upgraded
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Nav Menu Collapse
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.36 ▼0.012.02 ▼0.2243.85 ▼3.02
Dashboard /wp-admin2,196 ▲195.55 ▼0.1196.41 ▼0.1142.09 ▼2.34
Posts /wp-admin/edit.php2,104 ▲41.99 ▼0.0334.08 ▼3.5932.81 ▼1.59
Add New Post /wp-admin/post-new.php1,529 ▲323.09 ▼0.36659.17 ▼58.2460.67 ▲7.55
Media Library /wp-admin/upload.php1,404 ▲14.19 ▼0.0999.70 ▼9.3743.91 ▼0.59
Nav Menu Collapse /wp-admin/options-general.php?page=nav_menu_collapse_settings1,2412.6051.4647.53

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • nav_menu_collapse_version
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check 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=nav_menu_collapse_settings
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP Passed 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
Congratulations! This plugin passed the SRP test

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

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
The official readme.txt is a good inspiration

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

This is the main PHP file of "Nav Menu Collapse" version 2.1.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
79 characters long description:
Adds functionality to collapse and expand nav menus within the WordPress admin.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin4,431 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
PHP234661,8301,843
JavaScript446331,308
CSS43631,274
JSON1006

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity11.95
▷ Minimum class complexity1.00
▷ Maximum class complexity75.00
Average method complexity3.28
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes20
▷ Abstract classes210.00%
▷ Concrete classes1890.00%
▷ Final classes18100.00%
Methods96
▷ Static methods3839.58%
▷ Public methods7780.21%
▷ Protected methods1212.50%
▷ Private methods77.29%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants22
▷ Global constants00.00%
▷ Class constants22100.00%
▷ Public constants22100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
8 PNG files occupy 0.44MB with 0.15MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/release/images/YourWordPressDXP300x600.png136.86KB60.69KB▼ 55.65%
assets/release/images/noakes-plugins.png8.04KB6.25KB▼ 22.23%
assets/release/images/YourWordPressDXP728x90.png73.03KB33.27KB▼ 54.44%
assets/debug/images/noakes-plugins.png8.04KB6.25KB▼ 22.23%
assets/debug/images/robert-noakes.png6.28KB5.31KB▼ 15.39%