84% lwm-basic-auth

Code Review | Lightweb Media Basic Authentication

WordPress plugin Lightweb Media Basic Authentication scored84%from 54 tests.

About plugin

  • Plugin page: lwm-basic-auth
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.0.1
  • WordPress version: 6.3.1
  • First release: Aug 4, 2022
  • Latest release: Aug 4, 2022
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: piep (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /374 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼15.37ms] Passed 4 tests

A check of server-side resources used by Lightweb Media Basic Authentication
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0245.70 ▲3.58
Dashboard /wp-admin3.37 ▲0.0250.69 ▼41.12
Posts /wp-admin/edit.php3.48 ▲0.1251.25 ▼3.31
Add New Post /wp-admin/post-new.php5.95 ▲0.0586.51 ▼20.64
Media Library /wp-admin/upload.php3.29 ▲0.0640.82 ▲4.42

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 6 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
lwmba_auth_settings
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Lightweb Media Basic Authentication
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4414.72 ▲0.541.60 ▼0.2242.44 ▼1.53
Dashboard /wp-admin2,211 ▲345.63 ▼0.0387.02 ▼4.4240.61 ▼1.18
Posts /wp-admin/edit.php2,116 ▲162.04 ▲0.0836.12 ▼6.2638.51 ▲0.14
Add New Post /wp-admin/post-new.php1,548 ▲2218.34 ▼5.09668.35 ▼0.4576.36 ▲28.75
Media Library /wp-admin/upload.php1,419 ▲224.22 ▼0.0398.99 ▼11.9245.57 ▼0.59

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
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-posts
    • db_upgraded
    • lwmba_auth_settings
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/lwm-basic-auth/mu-plugin/lwm-mu-basic-auth.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/lwm-basic-auth/lwm-basic-auth.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Donate link: Invalid URI ("")
The official readme.txt is a good inspiration

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

The main file in "Lightweb Media Basic Authentication" v. 1.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
81 characters long description:
Basic Authentication for protected your development WordPress site like .htpasswd

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 detected265 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP47776265

PHP code Passed 2 tests

An short overview of 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.54
Average class complexity15.50
▷ Minimum class complexity11.00
▷ Maximum class complexity20.00
Average method complexity2.61
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods18
▷ Static methods00.00%
▷ Public methods1794.44%
▷ Protected methods00.00%
▷ Private methods15.56%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There were not PNG files found in your plugin