84% lnbits-bitcoin-onchain-and-lightning-payment-gateway

Code Review | # LNbits - Bitcoin Onchain and Lightning Payment Gateway

WordPress plugin # LNbits - Bitcoin Onchain and Lightning Payment Gateway scored84%from 54 tests.

About plugin

  • Plugin page: lnbits-bitcoin-on...
  • Plugin version: 0.0.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-6.4
  • WordPress version: 6.3.1
  • First release: Jul 14, 2022
  • Latest release: Nov 8, 2023
  • Number of updates: 7
  • Update frequency: every 69.0 days
  • Top authors: bclnbits (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /2,101 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.05MB] [CPU: ▼7.48ms] Passed 4 tests

This is a short check of server-side resources used by # LNbits - Bitcoin Onchain and Lightning Payment Gateway
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0635.25 ▼7.68
Dashboard /wp-admin3.37 ▲0.0243.34 ▼17.46
Posts /wp-admin/edit.php3.48 ▲0.1246.43 ▲0.38
Add New Post /wp-admin/post-new.php5.95 ▲0.0689.33 ▼5.15
Media Library /wp-admin/upload.php3.29 ▲0.0633.17 ▲1.61

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

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

Browser metrics Passed 4 tests

# LNbits - Bitcoin Onchain and Lightning Payment Gateway: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.67 ▲0.391.57 ▼0.3241.96 ▼2.60
Dashboard /wp-admin2,198 ▲215.62 ▼0.0291.70 ▼0.1741.09 ▼0.06
Posts /wp-admin/edit.php2,100 ▼01.94 ▼0.0139.81 ▲1.6536.55 ▲3.21
Add New Post /wp-admin/post-new.php1,535 ▲918.58 ▼4.59623.68 ▼13.1170.38 ▲20.64
Media Library /wp-admin/upload.php1,403 ▲34.23 ▲0.06100.57 ▲4.2543.04 ▼2.66

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/lnbits-bitcoin-onchain-and-lightning-payment-gateway/lnbits.php:12

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 93% 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 your attention:
  • Tags: Too many tags (14 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

lnbits-bitcoin-onchain-and-lightning-payment-gateway/lnbits.php 92% from 13 tests

This is the main PHP file of "# LNbits - Bitcoin Onchain and Lightning Payment Gateway" version 0.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("lnbits-bitcoin-onchain-and-lightning-payment-gateway.php" instead of "lnbits.php")

Code Analysis Passed 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
Everything looks great! No dangerous files found in this plugin375 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP45546336
Markdown110039

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity3.25
▷ Minimum class complexity1.00
▷ Maximum class complexity5.00
Average method complexity1.69
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods13
▷ Static methods17.69%
▷ Public methods1292.31%
▷ Protected methods00.00%
▷ Private methods17.69%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
4 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-256x256.png13.54KB6.18KB▼ 54.39%
assets/lightning.png1.86KB1.66KB▼ 10.74%
assets/bitcoin.png3.06KB2.06KB▼ 32.77%
assets/icon-128x128.png8.02KB3.69KB▼ 53.99%