72% ni-woocommerce-sales-report

Code Review | Ni WooCommerce Sales Report

WordPress plugin Ni WooCommerce Sales Report scored72%from 54 tests.

About plugin

  • Plugin page: ni-woocommerce-sa...
  • Plugin version: 3.7.3
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4.1
  • WordPress version: 6.3.1
  • First release: Apr 23, 2015
  • Latest release: Nov 23, 2023
  • Number of updates: 176
  • Update frequency: every 17.8 days
  • Top authors: anzia (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

800+ active /77,029 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.09MB] [CPU: ▼0.36ms] Passed 4 tests

A check of server-side resources used by Ni WooCommerce Sales Report
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0141.92 ▲2.72
Dashboard /wp-admin3.42 ▲0.1148.11 ▲0.41
Posts /wp-admin/edit.php3.54 ▲0.1749.21 ▲2.87
Add New Post /wp-admin/post-new.php6.00 ▲0.1183.04 ▼5.34
Media Library /wp-admin/upload.php3.35 ▲0.1136.02 ▲0.78
Order Product /wp-admin/admin.php?page=ni-order-product3.4431.57
Category Report /wp-admin/admin.php?page=ni-category-report3.3431.37
Summary Report /wp-admin/admin.php?page=ni-summary-report3.3430.06
Order Status Report /wp-admin/admin.php?page=ni-order-status-report3.3627.98
Monthly Sales Report /wp-admin/admin.php?page=ni-monthly-sales-report3.3432.67
Top Product /wp-admin/admin.php?page=ni-top-product-report3.3433.58
Other Plugins /wp-admin/admin.php?page=ni-sales-report-addons3.3431.37
Dashboard /wp-admin/admin.php?page=ni-sales-report3.5930.79
Product Analysis /wp-admin/admin.php?page=ni-product-analysis-report3.3741.60
Analytical Sales Report /wp-admin/admin.php?page=ni-analytical-sales-report3.3432.29

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 56 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
recovery_mode_email_last_sent
widget_recent-posts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Ni WooCommerce Sales Report
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,845 ▲8314.67 ▲0.331.74 ▼0.0944.00 ▲0.28
Dashboard /wp-admin2,247 ▲735.62 ▲0.0295.35 ▼5.7041.47 ▼1.58
Posts /wp-admin/edit.php2,155 ▲551.94 ▲0.0037.22 ▼2.4532.21 ▼1.28
Add New Post /wp-admin/post-new.php1,569 ▲4323.60 ▲0.44694.89 ▲90.0054.86 ▲3.25
Media Library /wp-admin/upload.php1,449 ▲464.24 ▲0.0297.52 ▼3.2545.59 ▲2.25
Order Product /wp-admin/admin.php?page=ni-order-product1,1082.6948.1592.91
Category Report /wp-admin/admin.php?page=ni-category-report1,0162.5142.3248.73
Summary Report /wp-admin/admin.php?page=ni-summary-report1,0062.5444.1344.25
Order Status Report /wp-admin/admin.php?page=ni-order-status-report1,0252.3543.0942.42
Monthly Sales Report /wp-admin/admin.php?page=ni-monthly-sales-report1,0532.4739.9141.43
Top Product /wp-admin/admin.php?page=ni-top-product-report9282.4732.7863.62
Other Plugins /wp-admin/admin.php?page=ni-sales-report-addons1,2622.2634.4351.33
Dashboard /wp-admin/admin.php?page=ni-sales-report1,6162.4920.7275.17
Product Analysis /wp-admin/admin.php?page=ni-product-analysis-report9442.5032.1445.28
Analytical Sales Report /wp-admin/admin.php?page=ni-analytical-sales-report9422.5439.3637.17

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • recovery_mode_email_last_sent
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=ni-sales-report
    • > Error in wp-content/plugins/ni-woocommerce-sales-report/include/order-summary.php+344
    Uncaught Error: Call to undefined function wc_price() in wp-content/plugins/ni-woocommerce-sales-report/include/order-summary.php:344
    Stack trace:
    #0 wp-content/plugins/ni-woocommerce-sales-report/include/base-sales-report.php(274): Summary->init()
    #1 wp-includes/class-wp-hook.php(310): BaseSalesReport->AddMenuPage()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=ni-analytical-sales-report
    • > Error in wp-content/plugins/ni-woocommerce-sales-report/include/ni-analytical-sales-report.php+177
    Uncaught Error: Call to undefined function wc_price() in wp-content/plugins/ni-woocommerce-sales-report/include/ni-analytical-sales-report.php:177
    Stack trace:
    #0 wp-content/plugins/ni-woocommerce-sales-report/include/ni-analytical-sales-report.php(77): Ni_Analytical_Sales_Report->get_tables()
    #1 wp-content/plugins/ni-woocommerce-sales-report/include/base-sales-report.php(164): Ni_Analytical_Sales_Report->get_ajax()
    #2 wp-includes/class-wp-hook.php(310): BaseSalesReport->ajax_sales_order()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin-ajax.php(188): do_action()
    #6 {main}
    thrown

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/ni-woocommerce-sales-report/ni-woocommerce-sales-report.php:23

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=ni-analytical-sales-report
    • > Network (severe)
    wp-admin/admin-ajax.php?action=sales_order&ajax_function=order_item&page=ni-analytical-sales-report - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Dashboard show sales report and key sale indicator), #2 (Recent order sales report), #3 (Order status reports on dashboard.), #4 (Payment method reports on dashboard), #5 (Sales order list with days filter option), #6 (Today Sales analysis on dashboard (Order Count, Sales, Product Sold, Discount, Tax).), #7 (Category sales report.), #8 (Top Product report (Today Top Product, Yesterday Top Product, Last 7 Days Top Product).), #9 (Order Summary Report.), #10 (Monthly sales report), #11 (Sales report menu), #12 (Current year vs previous sales), #13 (Order status report), #14 (Product analysis)
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
The official readme.txt is a good inspiration

ni-woocommerce-sales-report/ni-woocommerce-sales-report.php 92% from 13 tests

The primary PHP file in "Ni WooCommerce Sales Report" version 3.7.3 is used by WordPress to initiate all plugin functionality
Please take the time 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

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected23,246 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript112,4041,63512,741
CSS61561524,134
PHP146441503,493
SVG2002,678
PO File190217200

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity18.36
▷ Minimum class complexity1.00
▷ Maximum class complexity62.00
Average method complexity3.41
▷ Minimum method complexity1.00
▷ Maximum method complexity32.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods101
▷ Static methods00.00%
▷ Public methods101100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
15 PNG files occupy 0.90MB with 0.57MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-11.png10.83KB4.76KB▼ 56.02%
screenshot-4.png29.64KB9.15KB▼ 69.13%
screenshot-14.png52.85KB28.64KB▼ 45.80%
screenshot-12.png50.54KB12.71KB▼ 74.86%
screenshot-7.png22.42KB6.61KB▼ 70.49%