10% sales-trends-analysis-for-woocommerce

Code Review | Sales Trends Analysis for WooCommerce

WordPress plugin Sales Trends Analysis for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: sales-trends-anal...
  • Plugin version: 2.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.x-6.1.1
  • WordPress version: 6.3.1
  • First release: Apr 25, 2017
  • Latest release: Feb 21, 2023
  • Number of updates: 25
  • Update frequency: every 85.1 days
  • Top authors: infosoftplugin (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,030 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method IC_Sales_Trend_Analysis_Report_Lite::myplugin_activation() should not be called statically

Server metrics [RAM: ▲0.15MB] [CPU: ▼4.77ms] Passed 4 tests

Analyzing server-side resources used by Sales Trends Analysis for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1444.44 ▲1.23
Dashboard /wp-admin3.46 ▲0.1551.39 ▼0.27
Posts /wp-admin/edit.php3.57 ▲0.2251.70 ▼1.39
Add New Post /wp-admin/post-new.php6.04 ▲0.1584.74 ▼18.64
Media Library /wp-admin/upload.php3.38 ▲0.1542.68 ▲5.38
Sales Trend Analysis /wp-admin/admin.php?page=sales-analysis3.3936.77
Simple Prod. Order Qty. Analysis /wp-admin/admin.php?page=product-analysis3.3934.93
Variable Prod. Order Qty. Analysis /wp-admin/admin.php?page=variable-product-analysis3.4037.19
Setting /wp-admin/admin.php?page=ic-invoice-setting3.3533.88
Other Plug-ins /wp-admin/admin.php?page=ic-analysis-addon3.3535.04
Customer/Non Purchase /wp-admin/admin.php?page=customer-non-purchase3.5535.17

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 57 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
recovery_mode_email_last_sent
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

Sales Trends Analysis for WooCommerce: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,852 ▲9114.72 ▲0.372.01 ▼0.1742.51 ▲0.65
Dashboard /wp-admin2,221 ▲475.49 ▼0.1186.73 ▼0.2676.41 ▲32.74
Posts /wp-admin/edit.php2,135 ▲321.97 ▲0.0036.93 ▼16.7134.83 ▼3.75
Add New Post /wp-admin/post-new.php1,574 ▲4322.95 ▼0.32741.51 ▲25.2466.25 ▼8.08
Media Library /wp-admin/upload.php1,441 ▲444.13 ▼0.06106.82 ▲2.0477.45 ▲28.16
Sales Trend Analysis /wp-admin/admin.php?page=sales-analysis7991.4211.3934.73
Simple Prod. Order Qty. Analysis /wp-admin/admin.php?page=product-analysis1,0041.8426.3841.51
Variable Prod. Order Qty. Analysis /wp-admin/admin.php?page=variable-product-analysis1,0041.8229.6838.58
Setting /wp-admin/admin.php?page=ic-invoice-setting8811.8227.1825.88
Other Plug-ins /wp-admin/admin.php?page=ic-analysis-addon1,4611.8126.3942.17
Customer/Non Purchase /wp-admin/admin.php?page=customer-non-purchase9701.9128.0032.45

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin cannot be uninstalled
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method IC_Sales_Trend_Analysis_Report_Lite::myplugin_deactivate() should not be called statically
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Error in wp-content/plugins/sales-trends-analysis-for-woocommerce/include/ic-sales-analysis-dashboard.php+31
    Uncaught Error: Call to undefined function wc_price() in wp-content/plugins/sales-trends-analysis-for-woocommerce/include/ic-sales-analysis-dashboard.php:31
    Stack trace:
    #0 wp-content/plugins/sales-trends-analysis-for-woocommerce/include/init.php(104): ic_sales_analysis_dashboard->init()
    #1 wp-includes/class-wp-hook.php(310): ic_sta_lite_init->add_page()
    #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

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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/sales-trends-analysis-for-woocommerce/include/ic-sales-analysis-dashboard.php

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There are user-side issues you should fix
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=customer-non-purchase
    • > Network (severe)
    wp-content/plugins/sales-trends-analysis-for-woocommerce/js/ic-group-simple-product-analysis.js?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sales-trends-analysis-for-woocommerce/js/ic-single-product.js?ver=6.3.1:3:20)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sales-trends-analysis-for-woocommerce/js/ic-variable-product.js?ver=6.3.1:4:20)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sales-trends-analysis-for-woocommerce/js/ic-customer-in-price-point.js?ver=6.3.1:3:20)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sales-trends-analysis-for-woocommerce/js/ic-customer-non-purchase.js?ver=6.3.1:3:20)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sales-analysis
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: jQuery(...).datepicker is not a function

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Sales Trend Analysis Dashboard.), #2 (Sales Trend Analysis New Customer Repeat Customer Analysis.), #3 (Sales Trend Analysis top Customer Report who Orders Frequently), #4 (Sales Trend Analysis Customers who has not Purchased)
You can take inspiration from this readme.txt

sales-trends-analysis-for-woocommerce/ic-sales-trends-analysis-report-lite.php 69% from 13 tests

The main PHP file in "Sales Trends Analysis for WooCommerce" ver. 2.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Requires at least: Periods and digits should be used for the required version number (ex. "7.0" instead of "3.5.x")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: The principal plugin file should be the same as the plugin slug ("sales-trends-analysis-for-woocommerce.php" instead of "ic-sales-trends-analysis-report-lite.php")
  • Domain Path: The domain path folder does not exist ("/languages/")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected3,114 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP93811321,981
SVG100640
CSS311619373
JavaScript73038120

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity29.56
▷ Minimum class complexity1.00
▷ Maximum class complexity110.00
Average method complexity4.06
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods84
▷ Static methods00.00%
▷ Public methods84100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
16 PNG files occupy 0.21MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
include/images/icons/coupon-icon1.png1.25KB1.38KB0.00%
include/images/icons/product-icon.png1.67KB1.28KB▼ 23.20%
(invalid) screenshot-4.png55.81KB0.00KB▼ 100.00%
include/images/icons/category-icon.png1.16KB0.28KB▼ 75.63%
include/images/icons/average-icon.png0.54KB0.53KB▼ 2.33%