64% amazon-polly

Code Review | AWS for WordPress

WordPress plugin AWS for WordPress scored 64% from 54 tests.

About plugin

  • Plugin page: amazon-polly
  • Plugin version: 4.3.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.7.1
  • WordPress version: 5.9.2
  • First release: Feb 7, 2018
  • Latest release: Jun 2, 2021
  • Number of updates: 124
  • Update frequency: every 9.9 days
  • Top authors: awslabs (95.16%)troylar (4.03%)thliwiak (2.42%)

Code review

54 tests

User reviews

36 reviews

Install metrics

10,000+ active / 453,781 total downloads

Benchmarks

Plugin footprint 81% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲10.66MB] [CPU: ▼270.38ms] 25% from 4 tests

This is a short check of server-side resources used by AWS for WordPress
Please fix the following
  • RAM: Total memory usage must be kept under 10MB (currently 13.95MB on /wp-admin/admin.php?page=amazon_ai)
  • CPU: The total CPU usage must kept under 500.00ms (currently 5,243.38ms on /wp-admin/admin.php?page=amazon_ai_podcast)
  • Extra RAM: The extra memory usage must be under 5MB (currently 10.66MB on /wp-admin/admin.php?page=amazon_ai)
PageMemory (MB)CPU Time (ms)
Home /14.21 ▲10.6986.88 ▲37.30
Dashboard /wp-admin14.09 ▲10.6869.60 ▲31.48
Posts /wp-admin/edit.php14.32 ▲10.6870.47 ▲30.91
Add New Post /wp-admin/post-new.php17.56 ▲10.58127.86 ▼1,177.44
Media Library /wp-admin/upload.php13.98 ▲10.6856.32 ▲33.52
CloudFront /wp-admin/admin.php?page=amazon_cloudfront14.405,124.05
Customize /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php16.8986.27
Translate /wp-admin/admin.php?page=amazon_ai_translate14.415,115.11
Text-To-Speech /wp-admin/admin.php?page=amazon_ai_polly14.415,220.22
Podcast /wp-admin/admin.php?page=amazon_ai_podcast14.415,243.38
Alexa Integration /wp-admin/admin.php?page=amazon_ai_alexa13.9552.98
General /wp-admin/admin.php?page=amazon_ai13.9553.30

Server storage [IO: ▲36.00MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Please try to fix the following items
  • Total filesystem usage should be limited to 25MB (currently using 36.00MB)
Filesystem: 3,292 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
amazon_polly_region
amazon_polly_trans_enabled
aws_cloudfront_logfile
widget_recent-comments
amazon_polly_podcast_enabled
amazon_polly_valid_keys
amazon_ai_polly_enable

Browser metrics Passed 4 tests

This is an overview of browser requirements for AWS for WordPress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,007 ▲28516.90 ▲1.1810.77 ▲5.152.41 ▼0.28
Dashboard /wp-admin2,979 ▲1216.31 ▲0.02124.06 ▼17.57156.82 ▼1.67
Posts /wp-admin/edit.php2,771 ▲873.21 ▲0.1668.95 ▼6.20142.34 ▼2.00
Add New Post /wp-admin/post-new.php1,728 ▲6718.25 ▲2.03479.78 ▲52.36160.61 ▲3.50
Media Library /wp-admin/upload.php1,778 ▲805.63 ▲0.17130.17 ▼17.34191.50 ▲5.00
CloudFront /wp-admin/admin.php?page=amazon_cloudfront1,0502.8358.24100.35
Customize /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php7,47520.27511.96157.68
Translate /wp-admin/admin.php?page=amazon_ai_translate1,3192.8164.72147.03
Text-To-Speech /wp-admin/admin.php?page=amazon_ai_polly1,3222.8158.17135.75
Podcast /wp-admin/admin.php?page=amazon_ai_podcast1,0812.8359.08125.33
Alexa Integration /wp-admin/admin.php?page=amazon_ai_alexa1,0612.8358.20104.64
General /wp-admin/admin.php?page=amazon_ai1,1712.8459.40115.62

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • amazon_polly_valid_keys
    • amazon_ai_polly_enable
    • amazon_polly_podcast_enabled
    • aws_cloudfront_logfile

Smoke tests 0% 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
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php
    • > Notice in wp-includes/class-wp-customize-nav-menus.php+1152
    Trying to get property 'title' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/amazon-polly/vendor/mtdowling/jmespath.php/bin/jp.php
  • 1096× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/amazon-polly/vendor/aws/aws-sdk-php/src/TimestreamWrite/TimestreamWriteClient.php:39
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/Aws/SecretsManager/Exception/SecretsManagerException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Api\\Parser\\AbstractParser' not found in wp-content/plugins/amazon-polly/vendor/aws/aws-sdk-php/src/Api/Parser/AbstractRestParser.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/Aws/MTurk/Exception/MTurkException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/Aws/Appstream/Exception/AppstreamException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/aws-sdk-php/src/KinesisAnalytics/Exception/KinesisAnalyticsException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/aws-sdk-php/src/Honeycode/Exception/HoneycodeException.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Client\\ClientExceptionInterface' not found in wp-content/plugins/amazon-polly/vendor/psr/http-client/src/RequestExceptionInterface.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/amazon-polly/vendor/aws/Aws/WafRegional/Exception/WafRegionalException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/amazon-polly/vendor/aws/aws-sdk-php/src/Sqs/SqsClient.php:55

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php
    • > Network (severe)
    wp-admin/image.jpg - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: There are too many tags (12 tag instead of maximum 10)
The official readme.txt is a good inspiration

amazon-polly/amazonpolly.php 77% from 13 tests

"AWS for WordPress" version 4.3.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Description: Please keep the plugin description shorter than 140 characters (currently 277 characters long)
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("amazon-polly.php" instead of "amazonpolly.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin90,888 lines of code in 2,265 files:
LanguageFilesBlank linesComment linesLines of code
PHP2,18912,92357,74867,604
SVG30128,891
JSON35806,659
Markdown222,39106,606
JavaScript3100106747
CSS42013198
YAML422078
reStructuredText1352959
make210022
XML13014
Dockerfile18010

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity6.01
▷ Minimum class complexity1.00
▷ Maximum class complexity191.00
Average method complexity2.51
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces568
Interfaces77
Traits38
Classes1,338
▷ Abstract classes221.64%
▷ Concrete classes1,31698.36%
▷ Final classes352.66%
Methods4,790
▷ Static methods68414.28%
▷ Public methods3,43471.69%
▷ Protected methods2204.59%
▷ Private methods1,13623.72%
Functions858
▷ Named functions19222.38%
▷ Anonymous functions66677.62%
Constants363
▷ Global constants30.83%
▷ Class constants36099.17%
▷ Public constants360100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
10 PNG files occupy 2.02MB with 1.15MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-255x158.png27.14KB12.36KB▼ 54.48%
public/images/Voiced_by_Amazon_Polly_EN.png5.11KB3.12KB▼ 39.03%
assets/screenshot-2.png381.80KB111.58KB▼ 70.77%
assets/icon-128x128.png7.94KB3.44KB▼ 56.66%
img/amazon-polly-logo-white.png92.07KB34.78KB▼ 62.22%