78% add-amazon-block

Code Review | Amazon Block

WordPress plugin Amazon Block scored 78% from 54 tests.

About plugin

  • Plugin page: add-amazon-block
  • Plugin version: 0.2.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-4.9
  • WordPress version: 5.9.2
  • First release: Jan 9, 2018
  • Latest release: Jan 9, 2018
  • Number of updates: 4
  • Update frequency: every 0.3 days
  • Top authors: ryo511 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active / 1,022 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
Installer ran successfully

Server metrics [RAM: ▼1.49MB] [CPU: ▼333.43ms] Passed 4 tests

Analyzing server-side resources used by Amazon Block
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.95 ▼0.5618.17 ▼33.52
Dashboard /wp-admin2.87 ▼0.5414.83 ▼19.40
Posts /wp-admin/edit.php2.87 ▼0.7713.54 ▼23.40
Add New Post /wp-admin/post-new.php2.87 ▼4.1013.71 ▼1,257.38
Media Library /wp-admin/upload.php2.87 ▼0.4314.92 ▼9.06
AmazonJS /wp-admin/options-general.php?page=amazonjs2.8714.73

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 53 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Amazon Block
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,803 ▲4915.90 ▲0.256.24 ▼0.272.39 ▼0.02
Dashboard /wp-admin2,897 ▲436.11 ▼0.07120.35 ▼11.49159.04 ▼5.78
Posts /wp-admin/edit.php2,693 ▼13.36 ▲0.1364.69 ▲2.97144.38 ▲3.75
Add New Post /wp-admin/post-new.php1,673 ▼1717.36 ▼3.25419.89 ▼49.99154.92 ▼5.15
Media Library /wp-admin/upload.php1,703 ▲25.51 ▼0.03155.47 ▲18.04196.46 ▲9.73
AmazonJS /wp-admin/options-general.php?page=amazonjs1,3472.5455.15137.94

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/add-amazon-block/lib/amazonjs/amazonjs.php+371
    Undefined index: defaults

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Almost there, just fix the following server-side errors
  • 18 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=amazonjs
    • > Notice in wp-content/plugins/add-amazon-block/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/add-amazon-block/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/add-amazon-block/lib/amazonjs/amazonjs.php+650
    Undefined index: description

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
Please fix the following items
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-amazon-block/lib/amazonjs/amazonjs.php:984
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-amazon-block/lib/amazonjs/amazonjs.php:984
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-amazon-block/lib/amazonjs/amazonjs.php:984
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/add-amazon-block/lib/amazonjs/media-upload-type-amazonjs.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 issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Donate link: Invalid URI ("")
The official readme.txt is a good inspiration

add-amazon-block/index.php 92% from 13 tests

"Amazon Block" version 0.2.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("add-amazon-block.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable 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

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
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

All PNG images should be compressed to minimize bandwidth usage for end users
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/amazon-icon.png0.49KB0.47KB▼ 3.39%
lib/amazonjs/screenshot-1.png12.23KB5.55KB▼ 54.64%
lib/amazonjs/images/amazonjs.png1.77KB1.33KB▼ 25.18%