73% simple-amazon-affiliate

Code Review | Simple Amazon Affiliate

WordPress plugin Simple Amazon Affiliate scored73%from 54 tests.

About plugin

  • Plugin page: simple-amazon-aff...
  • Plugin version: 1.0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.2
  • WordPress version: 6.3.1
  • First release: Feb 14, 2015
  • Latest release: Sep 26, 2015
  • Number of updates: 12
  • Update frequency: every 19.0 days
  • Top authors: duogeek (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,644 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼18.83ms] Passed 4 tests

This is a short check of server-side resources used by Simple Amazon Affiliate
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.70 ▲0.2427.55 ▼15.67
Dashboard /wp-admin3.38 ▲0.0832.59 ▼14.11
Posts /wp-admin/edit.php3.46 ▲0.1034.37 ▼17.23
Add New Post /wp-admin/post-new.php5.70 ▼0.1968.94 ▼28.30
Media Library /wp-admin/upload.php3.40 ▲0.1830.92 ▲0.08
DuoGeek /wp-admin/admin.php?page=duogeek-panel3.3628.28
Help /wp-admin/admin.php?page=duogeek-panel-help3.3626.65
Amazon Affiliate /wp-admin/admin.php?page=saa-affiliate3.3625.95
Licenses /wp-admin/admin.php?page=duogeek-pro-licenses3.3629.86

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 164 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-posts
widget_recent-comments
recovery_mode_email_last_sent
theysaidso_admin_options

Browser metrics Passed 4 tests

Simple Amazon Affiliate: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,984 ▲24913.89 ▼0.406.14 ▲4.2944.79 ▼1.80
Dashboard /wp-admin2,268 ▲805.11 ▲0.07105.24 ▲3.7643.79 ▲1.27
Posts /wp-admin/edit.php2,156 ▲672.30 ▲0.2635.49 ▼8.1734.04 ▲0.07
Add New Post /wp-admin/post-new.php1,726 ▲18322.22 ▲3.77613.39 ▼23.3727.18 ▼23.03
Media Library /wp-admin/upload.php1,453 ▲684.58 ▲0.3697.19 ▼4.6841.11 ▼1.09
DuoGeek /wp-admin/admin.php?page=duogeek-panel7821.146.6923.82
Help /wp-admin/admin.php?page=duogeek-panel-help9142.1028.2426.47
Amazon Affiliate /wp-admin/admin.php?page=saa-affiliate1,1826.06107.0262.32
Licenses /wp-admin/admin.php?page=duogeek-pro-licenses8351.9526.5224.77

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • recovery_mode_email_last_sent
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=duogeek-pro-licenses
    • > Notice in wp-content/plugins/simple-amazon-affiliate/duogeek/duogeek-panel.php+147
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/admin.php?page=duogeek-panel
    • > Error in wp-content/plugins/simple-amazon-affiliate/duogeek/duogeek-panel.php+413
    Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/simple-amazon-affiliate/duogeek/duogeek-panel.php:413
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): DuoGeekPlugins->duogeek_panel_cb()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(259): do_action()
    #4 {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
Please take a closer look at the following
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/simple-amazon-affiliate/duogeek/duogeek-panel.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/simple-amazon-affiliate/duogeek/class.customPostType.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/simple-amazon-affiliate/duogeek/helper.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/simple-amazon-affiliate/amazon-files/classes/class.widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/simple-amazon-affiliate/simple-amazon-affiliate.php:13

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=saa-affiliate
    • > 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: $(...).iCheck is not a function" "TypeError: $(...).iCheck is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/simple-amazon-affiliate/duogeek/inc/duogeek.js?ver=1.1:8:36)\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=saa-affiliate
    • > 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: $(...).iCheck is not a function
    • > GET request to /wp-admin/admin.php?page=saa-affiliate
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/admin.php?page=saa-affiliate
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
7 plugin tags: frequently asked questions, faqs, faq for wordpress, faq, faq wordpress...

simple-amazon-affiliate/simple-amazon-affiliate.php Passed 13 tests

The entry point to "Simple Amazon Affiliate" version 1.0.9 is a PHP file that has certain tags in its header comment area
76 characters long description:
A Simple and Revenue Generating Amazon Product Affiliate plugin from DuoGeek

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin16,670 lines of code in 92 files:
LanguageFilesBlank linesComment linesLines of code
CSS558383009,583
JavaScript55509372,728
Sass1326241,352
LESS1326331,343
PHP5264781,099
SVG100565

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity27.25
▷ Minimum class complexity3.00
▷ Maximum class complexity59.00
Average method complexity3.84
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes125.00%
▷ Concrete classes375.00%
▷ Final classes00.00%
Methods37
▷ Static methods00.00%
▷ Public methods3286.49%
▷ Protected methods513.51%
▷ Private methods00.00%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants16100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
66 compressed PNG files occupy 0.16MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
duogeek/inc/icheck/skins/flat/aero.png1.48KB1.66KB0.00%
duogeek/inc/icheck/skins/minimal/yellow@2x.png1.37KB2.66KB0.00%
duogeek/inc/icheck/skins/flat/orange@2x.png3.20KB2.86KB▼ 10.56%
duogeek/inc/icheck/skins/flat/purple@2x.png3.14KB2.73KB▼ 12.99%
duogeek/inc/icheck/skins/minimal/aero@2x.png1.38KB2.66KB0.00%