68% add-amazon-block

Code Review | Amazon Block

WordPress plugin Amazon Block scored68%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: 6.3.1
  • 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,287 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▼1.23MB] [CPU: ▼45.41ms] Passed 4 tests

A check of server-side resources used by Amazon Block
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.74 ▼0.7215.07 ▼31.70
Dashboard /wp-admin2.78 ▼0.5217.51 ▼32.83
Posts /wp-admin/edit.php2.78 ▼0.5717.48 ▼33.54
Add New Post /wp-admin/post-new.php2.78 ▼3.1017.61 ▼83.57
Media Library /wp-admin/upload.php2.78 ▼0.4515.07 ▼24.22
AmazonJS /wp-admin/options-general.php?page=amazonjs2.7818.77

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, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

Amazon Block: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,846 ▲8513.26 ▼1.481.91 ▲0.0637.35 ▼8.03
Dashboard /wp-admin2,225 ▲224.83 ▼0.99111.93 ▲1.0441.84 ▼1.02
Posts /wp-admin/edit.php2,104 ▲41.99 ▼0.0038.71 ▲1.8640.27 ▲4.63
Add New Post /wp-admin/post-new.php6,200 ▲4,65519.17 ▼3.99843.35 ▲168.3751.29 ▼0.92
Media Library /wp-admin/upload.php1,404 ▲74.21 ▼0.0298.26 ▼5.9842.55 ▼3.95
AmazonJS /wp-admin/options-general.php?page=amazonjs1,0572.0626.4336.01

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/add-amazon-block/lib/amazonjs/amazonjs.php+371
    Undefined index: defaults
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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/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 | 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
  • 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_filter() in wp-content/plugins/add-amazon-block/lib/amazonjs/media-upload-type-amazonjs.php:8
    • > 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

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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:
  • Donate link: Invalid URI ("Bitcoin( 3AqQnhQEXJ9tA8w54n7ZUiDdeRBrX2onsA )")
The official readme.txt is a good inspiration

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

"Amazon Block" version 0.2.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: Name the main plugin file 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 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! 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 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.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/screenshot-1.png12.23KB5.55KB▼ 54.64%
lib/amazonjs/images/amazon-icon.png0.49KB0.47KB▼ 3.39%