78% woo-purchase-analysis

Code Review | WooCommerce Purchase Analysis

WordPress plugin WooCommerce Purchase Analysis scored78%from 54 tests.

About plugin

  • Plugin page: woo-purchase-anal...
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.3-5.2.1
  • WordPress version: 6.3.1
  • First release: Jul 8, 2019
  • Latest release: Jul 8, 2019
  • Number of updates: 4
  • Update frequency: every 1.0 days
  • Top authors: acespritech (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /568 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼8.00ms] Passed 4 tests

Server-side resources used by WooCommerce Purchase Analysis
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.97 ▲0.28
Dashboard /wp-admin3.31 ▲0.0050.82 ▼11.31
Posts /wp-admin/edit.php3.36 ▲0.0049.94 ▼4.15
Add New Post /wp-admin/post-new.php5.89 ▲0.0092.50 ▼16.02
Media Library /wp-admin/upload.php3.23 ▲0.0037.09 ▼0.53

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

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

Browser metrics Passed 4 tests

A check of browser resources used by WooCommerce Purchase Analysis
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.35 ▼0.011.72 ▼0.0141.55 ▼3.22
Dashboard /wp-admin2,198 ▲185.63 ▼0.0288.78 ▲2.8839.57 ▼3.87
Posts /wp-admin/edit.php2,103 ▲31.99 ▼0.0339.42 ▼0.6234.51 ▼2.22
Add New Post /wp-admin/post-new.php1,535 ▲918.32 ▼4.92631.39 ▼27.6062.64 ▲15.17
Media Library /wp-admin/upload.php1,403 ▲34.20 ▲0.04100.35 ▼3.4142.74 ▼6.18

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

Smoke tests 50% 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 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/woo-purchase-analysis/include/modal.php
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/woo-purchase-analysis/woo-purchase-analysis.php on line 12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_plugin_active() in wp-content/plugins/woo-purchase-analysis/woo-purchase-analysis.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_permalink() in wp-content/plugins/woo-purchase-analysis/include/purchase-analysis.php:2
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/woo-purchase-analysis/woo-purchase-analysis.php on line 12
    • > PHP Notice
      Undefined variable: customer_orders in wp-content/plugins/woo-purchase-analysis/include/modal.php on line 21
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/woo-purchase-analysis/include/modal.php on line 7
    • > PHP Notice
      Undefined variable: product_data in wp-content/plugins/woo-purchase-analysis/include/modal.php on line 7
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/woo-purchase-analysis/include/modal.php on line 21
    • > PHP Notice
      Undefined variable: product_id in wp-content/plugins/woo-purchase-analysis/include/modal.php on line 2
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/woo-purchase-analysis/woo-purchase-analysis.php on line 12

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 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (My Purchase tab display purchase products with quantity.), #2 (click on product quantity that display selected product quantity and amount in different order.), #3 (Purchase analysis tab display year filter and display payment method , product and category details for selected year.), #4 (This pie chart display which different payment method customer used for pay order amount.), #5 (Above chart represent category wise product count which customer was purchase.), #6 (This chart show products and their quantity which customer was purchase.), #7 (Customer can select year and their category.)
You can take inspiration from this readme.txt

woo-purchase-analysis/woo-purchase-analysis.php 92% from 13 tests

The entry point to "WooCommerce Purchase Analysis" version 1.1.0 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Domain Path: The domain path points to an invalid folder, "/languages/" does not exist

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
No dangerous file extensions were detected12,773 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript42,2142,17711,012
PHP659261,150
CSS346611

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.07MB with 0.03MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/payment-option.png23.27KB11.98KB▼ 48.53%
images/icon_8433.png50.42KB37.56KB▼ 25.51%