83% esewa

Code Review | eSewa - Nepal First Payment Gateway

WordPress plugin eSewa - Nepal First Payment Gateway scored83%from 54 tests.

About plugin

  • Plugin page: esewa
  • Plugin version: 0.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.5
  • WordPress version: 6.3.1
  • First release: Sep 30, 2020
  • Latest release: Nov 4, 2020
  • Number of updates: 8
  • Update frequency: every 4.4 days
  • Top authors: esewaofficial (100%)

Code review

54 tests

User reviews

1 review

Install metrics

600+ active /6,690 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼6.11ms] Passed 4 tests

Analyzing server-side resources used by eSewa - Nepal First Payment Gateway
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0140.15 ▼2.96
Dashboard /wp-admin3.31 ▲0.0149.59 ▼1.99
Posts /wp-admin/edit.php3.36 ▲0.0144.56 ▼6.60
Add New Post /wp-admin/post-new.php5.89 ▲0.0184.12 ▼12.90
Media Library /wp-admin/upload.php3.23 ▲0.0138.40 ▲4.68

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 15 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-comments
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for eSewa - Nepal First Payment Gateway
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,803 ▲4214.76 ▲0.411.72 ▲0.0543.88 ▲0.61
Dashboard /wp-admin2,209 ▲355.52 ▼0.0288.43 ▼1.6938.72 ▼4.32
Posts /wp-admin/edit.php2,114 ▲142.01 ▼0.0235.28 ▼4.3634.72 ▼3.32
Add New Post /wp-admin/post-new.php1,537 ▲423.09 ▲0.15642.43 ▲21.1754.99 ▲3.47
Media Library /wp-admin/upload.php1,408 ▲84.24 ▲0.0797.92 ▼4.0342.09 ▼6.35

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/esewa/method/inc/template/message-view.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/esewa/method/inc/order/order-detail.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Plugin settings), #2 (checkout page), #3 (confirmation for proceeding to eSewa gateway)
  • Contributors: Plugin contributors field is missing
The official readme.txt is a good inspiration

esewa/index.php 85% from 13 tests

The main PHP file in "eSewa - Nepal First Payment Gateway" ver. 0.2 adds more information about the plugin and also serves as the entry point for this plugin
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 ("esewa.php" instead of "index.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

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
Everything looks great! No dangerous files found in this plugin678 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP816158651
JavaScript25627

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity15.80
▷ Minimum class complexity4.00
▷ Maximum class complexity35.00
Average method complexity3.18
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes120.00%
▷ Concrete classes480.00%
▷ Final classes125.00%
Methods34
▷ Static methods25.88%
▷ Public methods2058.82%
▷ Protected methods1235.29%
▷ Private methods25.88%
Functions3
▷ Named functions3100.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
4 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/esewa_logo.png4.38KB2.67KB▼ 39.11%
assets/images/esewa__.png6.96KB2.92KB▼ 58.13%
assets/images/esewa_.png1.48KB1.38KB▼ 6.68%
assets/images/esewa.png40.97KB16.02KB▼ 60.91%