78% affiliate-amazon-blockaab

Code Review | affiliate-amazon-block(aab)

WordPress plugin affiliate-amazon-block(aab) scored 78% from 54 tests.

About plugin

  • Plugin page: affiliate-amazon-...
  • Plugin version: 0.1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.1
  • WordPress version: 5.8.1
  • First release: Feb 24, 2019
  • Latest release: Feb 24, 2019
  • Number of updates: 3
  • Update frequency: N/A
  • Top authors: ryoraspp (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 871 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.86MB] [CPU: ▼183.30ms] Passed 4 tests

A check of server-side resources used by affiliate-amazon-block(aab)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.74 ▲0.0218.81 ▼1.52
Dashboard /wp-admin2.79 ▼0.2716.93 ▼30.03
Posts /wp-admin/edit.php2.79 ▼0.3216.73 ▼40.75
Add New Post /wp-admin/post-new.php2.79 ▼2.6418.16 ▼650.35
Media Library /wp-admin/upload.php2.79 ▼0.2119.97 ▼12.08
affiliate-amazon-block(aab) /wp-admin/options-general.php?page=amazonjs2.7918.20

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 54 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for affiliate-amazon-block(aab)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,685 ▲8915.87 ▲0.1911.87 ▲2.2846.71 ▼3.81
Dashboard /wp-admin2,972 ▲625.89 ▼0.29140.74 ▼28.44110.20 ▼44.79
Posts /wp-admin/edit.php2,744 ▲52.73 ▲0.0166.29 ▼6.1886.15 ▼12.13
Add New Post /wp-admin/post-new.php1,627 ▲1221.20 ▼0.22338.38 ▲33.52126.44 ▲20.26
Media Library /wp-admin/upload.php1,815 ▲85.05 ▲0.02163.03 ▲6.32118.26 ▲7.85
affiliate-amazon-block(aab) /wp-admin/options-general.php?page=amazonjs1,3832.0967.6683.30

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
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php+371
    Undefined index: defaults

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 18 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=amazonjs
    • > Notice in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php+371
    Undefined index: defaults
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=amazonjs
    • > Notice in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php+637
    Undefined index: placeholder
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=amazonjs
    • > Notice in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php+650
    Undefined index: description

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
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php:984
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php:984
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/media-upload-type-amazonjs.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/affiliate-amazon-blockaab/lib/amazonjs/amazonjs.php:984

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that require attention:
  • Donate link: Invalid URI found ("")
  • Screenshots: Please add an image for screenshot #1 (Search by Amazon API)
The official readme.txt might help

affiliate-amazon-blockaab/index.php 92% from 13 tests

The entry point to "affiliate-amazon-block(aab)" version 0.1.0 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("affiliate-amazon-blockaab.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin9,524 lines of code in 39 files:
LanguageFilesBlank linesComment linesLines of code
JSON3005,420
PHP72453892,359
JavaScript226429965
CSS4112374
PO File1141143373
Markdown116023
XML13010

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity46.20
▷ Minimum class complexity1.00
▷ Maximum class complexity115.00
Average method complexity5.11
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods55
▷ Static methods47.27%
▷ Public methods5498.18%
▷ Protected methods00.00%
▷ Private methods11.82%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants763.64%
▷ Class constants436.36%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/amazonjs/images/amazonjs.png1.77KB1.33KB▼ 25.18%
lib/amazonjs/images/amazon-icon.png0.49KB0.47KB▼ 3.39%
lib/amazonjs/screenshot-1.png12.23KB5.55KB▼ 54.64%