83% np-forex-commodity-widget

Code Review | NP Forex Commodity Widget

WordPress plugin NP Forex Commodity Widget scored83%from 54 tests.

About plugin

  • Plugin page: np-forex-commodit...
  • Plugin version: 1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.5
  • WordPress version: 6.3.1
  • First release: Mar 27, 2018
  • Latest release: Aug 5, 2020
  • Number of updates: 13
  • Update frequency: every 66.6 days
  • Top authors: maheshmaharjan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /2,175 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.16MB] [CPU: ▲263.65ms] 75% from 4 tests

This is a short check of server-side resources used by NP Forex Commodity Widget
Please have a look at the following items
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 263.65ms on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.22314.09 ▲270.94
Dashboard /wp-admin3.50 ▲0.19320.70 ▲271.66
Posts /wp-admin/edit.php3.55 ▲0.19383.41 ▲331.45
Add New Post /wp-admin/post-new.php6.01 ▲0.13351.26 ▲260.09
Media Library /wp-admin/upload.php3.36 ▲0.13287.28 ▲251.92

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 33 new files
Database: no new tables, 9 new options
New WordPress options
widget_fuel-widget
db_upgraded
widget_recent-comments
widget_commodity-widget
widget_recent-posts
widget_ex-rates-widget
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by NP Forex Commodity Widget
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,875 ▲14013.83 ▼0.547.59 ▲5.8338.49 ▼6.44
Dashboard /wp-admin2,206 ▲155.88 ▲0.98104.18 ▼9.9739.28 ▼5.85
Posts /wp-admin/edit.php2,089 ▼01.97 ▼0.0239.16 ▼4.9134.96 ▼3.90
Add New Post /wp-admin/post-new.php1,532 ▲1321.11 ▼2.33632.54 ▲6.7964.59 ▲17.38
Media Library /wp-admin/upload.php1,388 ▼34.14 ▼0.1089.84 ▼8.3641.17 ▼1.92

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Zombie WordPress options were found after uninstall: 9 options
    • widget_recent-posts
    • widget_recent-comments
    • widget_ex-rates-widget
    • widget_fuel-widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_commodity-widget
    • widget_theysaidso_widget
    • can_compress_scripts

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
The smoke test was a success, however most plugin functionality was not tested

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
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/np-forex-commodity-widget/inc/nfcw-fuel-price.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/np-forex-commodity-widget/inc/nfcw-commodity-price.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/np-forex-commodity-widget/inc/nfcw-ex-rates.php:2

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 83% 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: You can look at the official readme.txt

np-forex-commodity-widget/nfcw-commodity-widget.php 69% from 13 tests

The main PHP file in "NP Forex Commodity Widget" ver. 1.6 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("np-forex-commodity-widget.php" instead of "nfcw-commodity-widget.php")
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Description: Keep the plugin description shorter than 140 characters (currently 156 characters long)

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 plugin894 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP59352448
SVG2100292
CSS217080
Markdown132062
JavaScript16012

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity14.40
▷ Minimum class complexity6.00
▷ Maximum class complexity29.00
Average method complexity3.91
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods26
▷ Static methods27.69%
▷ Public methods26100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions00.00%
▷ Anonymous functions3100.00%
Constants10
▷ Global constants10100.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
PNG images were not found in this plugin