78% http-basic-auth

Code Review | HTTP Basic Auth

WordPress plugin HTTP Basic Auth scored78%from 54 tests.

About plugin

  • Plugin page: http-basic-auth
  • Plugin version: 1.1.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9
  • WordPress version: 6.3.1
  • First release: May 5, 2018
  • Latest release: Feb 27, 2022
  • Number of updates: 5
  • Update frequency: every 278.8 days
  • Top authors: grola (100%)

Code review

54 tests

User reviews

1 review

Install metrics

300+ active /7,975 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.47MB] [CPU: ▼6.28ms] Passed 4 tests

A check of server-side resources used by HTTP Basic Auth
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.93 ▲0.4746.49 ▼5.91
Dashboard /wp-admin3.81 ▲0.5150.07 ▲0.90
Posts /wp-admin/edit.php3.86 ▲0.5150.24 ▼1.39
Add New Post /wp-admin/post-new.php6.33 ▲0.4596.43 ▼18.73
Media Library /wp-admin/upload.php3.67 ▲0.4541.05 ▲8.38
Basic Auth /wp-admin/options-general.php?page=http-basic-auth-settings3.6944.68

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 29 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_recent-comments
http_basic_auth_settings
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for HTTP Basic Auth
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲9413.56 ▼0.791.81 ▼0.0640.38 ▼4.18
Dashboard /wp-admin2,210 ▲194.84 ▼0.04108.07 ▼2.1843.54 ▼0.14
Posts /wp-admin/edit.php2,093 ▲12.01 ▼0.0440.95 ▼2.1435.81 ▼1.33
Add New Post /wp-admin/post-new.php1,517 ▼1717.57 ▼5.66671.78 ▲66.4161.50 ▲11.07
Media Library /wp-admin/upload.php1,389 ▼24.17 ▼0.0797.37 ▼4.6546.41 ▲1.77
Basic Auth /wp-admin/options-general.php?page=http-basic-auth-settings1,1723.8961.6528.62

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • http_basic_auth_settings
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/http-basic-auth/classes/views/settings-script.php
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WPDesk_Plugin_1_9' not found in wp-content/plugins/http-basic-auth/classes/class-http-basic-auth-plugin.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Add an image for screenshot #1 (Configuration)
Please take inspiration from this readme.txt

http-basic-auth/http-basic-auth.php Passed 13 tests

The entry point to "HTTP Basic Auth" version 1.1.0 is a PHP file that has certain tags in its header comment area
42 characters long description:
Basic Auth form login, admin or whole site

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
Success! There were no dangerous files found in this plugin2,675 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP136191,1742,348
PO File289189162
CSS6141691
JavaScript2181374

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity46.20
▷ Minimum class complexity1.00
▷ Maximum class complexity167.00
Average method complexity3.69
▷ Minimum method complexity1.00
▷ Maximum method complexity35.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods168
▷ Static methods21.19%
▷ Public methods15894.05%
▷ Protected methods10.60%
▷ Private methods95.36%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/repository/screenshot-1.png47.49KB17.89KB▼ 62.33%