83% simple-affiliate-for-woocommerce

Code Review | Simple Affiliate for WooCommerce

WordPress plugin Simple Affiliate for WooCommerce scored 83% from 54 tests.

About plugin

  • Plugin page: simple-affiliate-...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5.1-5.9.0
  • WordPress version: 5.9.2
  • First release: Feb 16, 2022
  • Latest release: Feb 16, 2022
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: olegisk (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 33 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.19MB] [CPU: ▼304.42ms] Passed 4 tests

Analyzing server-side resources used by Simple Affiliate for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.79 ▲0.2759.69 ▲7.54
Dashboard /wp-admin3.62 ▲0.2141.99 ▲2.30
Posts /wp-admin/edit.php3.85 ▲0.2164.28 ▲23.75
Add New Post /wp-admin/post-new.php7.08 ▲0.11103.43 ▼1,223.35
Media Library /wp-admin/upload.php3.50 ▲0.2127.59 ▼4.18
Settings /wp-admin/admin.php?page=affiliate_settings3.4727.63
Affiliate /wp-admin/admin.php?page=affiliate3.4725.22

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 45 new files
Database: 2 new tables, no new options
New tables
wp_affiliate_spending
wp_affiliate_earnings

Browser metrics Passed 4 tests

Simple Affiliate for WooCommerce: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,946 ▲19217.24 ▲1.4912.21 ▲5.782.54 ▲0.07
Dashboard /wp-admin2,912 ▲586.00 ▼0.12117.77 ▼18.20155.51 ▼1.12
Posts /wp-admin/edit.php2,725 ▲313.24 ▲0.0064.02 ▲1.38143.59 ▲2.71
Add New Post /wp-admin/post-new.php1,683 ▼6917.88 ▼3.14399.53 ▼72.55163.66 ▲7.69
Media Library /wp-admin/upload.php1,732 ▲345.50 ▼0.01141.59 ▼3.31193.42 ▼19.21
Settings /wp-admin/admin.php?page=affiliate_settings1,1222.4176.09134.93
Affiliate /wp-admin/admin.php?page=affiliate9892.3656.2086.15

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • The plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_affiliate_spending
    • wp_affiliate_earnings

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

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 fix the following
  • 9× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/simple-affiliate-for-woocommerce/templates/affiliate/user-edit.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/simple-affiliate-for-woocommerce/templates/affiliate/affiliate-form.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/simple-affiliate-for-woocommerce/includes/class-wc-simple-affiliate-dashboard.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/simple-affiliate-for-woocommerce/includes/class-wc-simple-affiliate-user.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/simple-affiliate-for-woocommerce/includes/class-wc-simple-affiliate-history.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/simple-affiliate-for-woocommerce/includes/class-wc-simple-affiliate.php:18
    • > PHP Notice
      Undefined variable: balance in wp-content/plugins/simple-affiliate-for-woocommerce/templates/affiliate/balance.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/simple-affiliate-for-woocommerce/includes/class-wc-simple-affiliate-settings.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/simple-affiliate-for-woocommerce/templates/affiliate/dashboard.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 86% 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
Please fix the following attributes: Please take inspiration from this readme.txt

simple-affiliate-for-woocommerce/simple-affiliate-woocommerce.php 77% from 13 tests

The main file in "Simple Affiliate for WooCommerce" v. 1.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("simple-affiliate-for-woocommerce.php" instead of "simple-affiliate-woocommerce.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.3" instead of "5.5.1")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin26,275 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript54681,65819,948
CSS91863325,163
PHP112023641,144
Markdown29020

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity15.17
▷ Minimum class complexity1.00
▷ Maximum class complexity45.00
Average method complexity2.73
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods49
▷ Static methods1632.65%
▷ Public methods49100.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 Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
14 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/vendor/jquery-ui/themes/ui-lightness/images/ui-icons_ffd27a_256x240.png4.44KB4.17KB▼ 6.02%
assets/vendor/jquery-ui/themes/ui-lightness/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%
assets/vendor/jquery-ui/themes/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png0.26KB0.12KB▼ 53.44%
assets/vendor/jquery-ui/themes/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png0.30KB0.15KB▼ 49.68%
assets/vendor/jquery-ui/themes/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png0.34KB0.16KB▼ 54.02%