10% affiliates-referrals-for-woocommerce

Code Review | Affiliates Referral for WC

WordPress plugin Affiliates Referral for WC scored 10% from 54 tests.

About plugin

  • Plugin page: affiliates-referr...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress version: 5.9.2
  • First release: Jun 5, 2016
  • Latest release: Jun 8, 2016
  • Number of updates: 5
  • Update frequency: every 1.0 days
  • Top authors: Sumesh_S (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,283 total downloads

Benchmarks

Plugin footprint 75% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Notice in wp-content/plugins/affiliates-referrals-for-woocommerce/index.php+26
    Undefined variable: wpdb

Server metrics [RAM: ▲0.05MB] [CPU: ▼315.72ms] Passed 4 tests

An overview of server-side resources used by Affiliates Referral for WC
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.2458.77 ▲2.39
Dashboard /wp-admin3.49 ▲0.0834.43 ▲0.46
Posts /wp-admin/edit.php3.72 ▲0.0848.44 ▼2.59
Add New Post /wp-admin/post-new.php6.96 ▼0.0297.59 ▼1,258.65
Media Library /wp-admin/upload.php3.37 ▲0.0725.72 ▼2.10
Referral Edits /wp-admin/admin.php?page=aff-wc-referral-edits3.3322.47

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 8 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Affiliates Referral for WC: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,823 ▲6915.53 ▼0.135.67 ▼0.252.99 ▲0.32
Dashboard /wp-admin2,920 ▲626.10 ▼0.08120.60 ▼19.51219.59 ▼4.61
Posts /wp-admin/edit.php2,720 ▲353.24 ▲0.0063.17 ▼4.19143.90 ▼12.81
Add New Post /wp-admin/post-new.php1,715 ▼4516.93 ▼6.00477.88 ▲35.26185.13 ▲10.83
Media Library /wp-admin/upload.php1,726 ▲285.54 ▲0.03143.19 ▲0.46193.84 ▼74.34
Referral Edits /wp-admin/admin.php?page=aff-wc-referral-edits1,0042.3754.03188.25

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
The following issues need your attention
  • 3× 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/affiliates-referrals-for-woocommerce/includes/index.php on line 4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-includes/pluggable.php' (include_path='.:/usr/share/php') in wp-content/plugins/affiliates-referrals-for-woocommerce/includes/index.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-includes/pluggable.php): failed to open stream: No such file or directory in wp-content/plugins/affiliates-referrals-for-woocommerce/includes/index.php on line 4

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 81% 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:
  • Tags: There are too many tags (22 tag instead of maximum 10)
  • Plugin Name: You should set the name of your plugin on the first line ( === affiliates-referrals-for-woocommerce === )
  • Donate link: Please fix this invalid URI: ""
The official readme.txt is a good inspiration

affiliates-referrals-for-woocommerce/index.php 92% from 13 tests

"Affiliates Referral for WC" version 1.0.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("affiliates-referrals-for-woocommerce.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected325 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP412823325

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity29.50
▷ Minimum class complexity10.00
▷ Maximum class complexity49.00
Average method complexity4.80
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods15
▷ Static methods15100.00%
▷ Public methods15100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.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
3 PNG files occupy 0.08MB with 0.04MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshots/screenshot-1.png38.31KB17.78KB▼ 53.59%
screenshots/screenshot-2.png42.55KB19.32KB▼ 54.59%
assets/images/icon.png1.49KB0.89KB▼ 40.21%