10% 2kb-amazon-affiliates-store

Code Review | 2kb Amazon Affiliates Store

WordPress plugin 2kb Amazon Affiliates Store scored 10% from 54 tests.

About plugin

  • Plugin page: 2kb-amazon-affili...
  • Plugin version: 2.1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.8
  • WordPress version: 5.9.2
  • First release: May 26, 2014
  • Latest release: Nov 16, 2018
  • Number of updates: 59
  • Update frequency: every 27.7 days
  • Top authors: 2kblater.com (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

30+ active / 12,321 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/2kb-amazon-affiliates-store/store_functions.php+9
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

Server metrics [RAM: ▼2.42MB] [CPU: ▼360.52ms] Passed 4 tests

A check of server-side resources used by 2kb Amazon Affiliates Store
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /1.95 ▼1.5612.25 ▼44.21
Dashboard /wp-admin1.97 ▼1.444.54 ▼34.69
Posts /wp-admin/edit.php1.97 ▼1.674.97 ▼53.66
Add New Post /wp-admin/post-new.php1.97 ▼5.003.99 ▼1,309.52
Media Library /wp-admin/upload.php1.97 ▼1.3251.87 ▲23.06

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 96 new files
Database: no new tables, 4 new options
New WordPress options
widget_kbamazonshomproductcategories
kbAmzStore
widget_kbamzattr
widget_kbamzsldr

Browser metrics Passed 4 tests

2kb Amazon Affiliates Store: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,935 ▲18116.27 ▲0.6210.02 ▲3.942.33 ▼0.25
Dashboard /wp-admin2,912 ▲516.17 ▲0.04123.61 ▼12.38176.45 ▼48.09
Posts /wp-admin/edit.php2,726 ▲353.10 ▼0.1464.35 ▼2.42150.09 ▲5.87
Add New Post /wp-admin/post-new.php1,649 ▼1216.34 ▼6.43413.56 ▼47.71211.83 ▲48.06
Media Library /wp-admin/upload.php1,717 ▲225.54 ▲0.01130.62 ▼20.20211.36 ▲20.75

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/2kb-amazon-affiliates-store/store_functions.php+9
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
  • Zombie WordPress options were found after uninstall: 4 options
    • kbAmzStore
    • widget_kbamzsldr
    • widget_kbamzattr
    • widget_kbamazonshomproductcategories

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/2kb-amazon-affiliates-store/store_widgets.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% 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 need to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === 2kb-amazon-affiliates-store === )
  • Contributors: The plugin contributors field is not present
Please take inspiration from this readme.txt

2kb-amazon-affiliates-store/plugin.php 85% from 13 tests

The principal PHP file in "2kb Amazon Affiliates Store" v. 2.1.5 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("2kb-amazon-affiliates-store.php" instead of "plugin.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 240 characters long)

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
There were no executable files found in this plugin24,473 lines of code in 69 files:
LanguageFilesBlank linesComment linesLines of code
PHP541,2552,41013,098
CSS741748,523
JavaScript67832852,469
SVG100288
LESS11895

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity58.28
▷ Minimum class complexity1.00
▷ Maximum class complexity555.00
Average method complexity3.99
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes28
▷ Abstract classes27.14%
▷ Concrete classes2692.86%
▷ Final classes00.00%
Methods558
▷ Static methods7914.16%
▷ Public methods48687.10%
▷ Protected methods6912.37%
▷ Private methods30.54%
Functions89
▷ Named functions89100.00%
▷ Anonymous functions00.00%
Constants21
▷ Global constants838.10%
▷ Class constants1361.90%
▷ Public constants13100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.13MB with 0.05MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
template/admin/img/amazonCheckout.png5.23KB3.76KB▼ 27.98%
template/admin/img/2kb-amazon-affiliate-product-logo.png123.46KB56.91KB▼ 53.91%