77% gcs

Code Review | Google Cloud Storage plugin

WordPress plugin Google Cloud Storage plugin scored77%from 54 tests.

About plugin

  • Plugin page: gcs
  • Plugin version: 0.1.6
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Feb 25, 2017
  • Latest release: Sep 2, 2020
  • Number of updates: 22
  • Update frequency: every 58.4 days
  • Top authors: google (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

700+ active /64,746 total downloads

Benchmarks

Plugin footprint 82% 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.80MB] [CPU: ▲1,412.45ms] 50% from 4 tests

A check of server-side resources used by Google Cloud Storage plugin
The following require your attention
  • CPU: Total CPU usage should be kept under 500.00ms (currently 1,221.12ms on /wp-admin/options-general.php?page=gcs)
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 1,412.45ms on /wp-admin/options-general.php?page=gcs)
PageMemory (MB)CPU Time (ms)
Home /4.29 ▲0.831,281.62 ▲1,242.47
Dashboard /wp-admin4.13 ▲0.831,546.42 ▲1,500.09
Posts /wp-admin/edit.php4.19 ▲0.831,471.43 ▲1,426.44
Add New Post /wp-admin/post-new.php6.65 ▲0.771,580.22 ▲1,480.79
Media Library /wp-admin/upload.php3.99 ▲0.771,540.12 ▲1,509.82
GCS /wp-admin/options-general.php?page=gcs3.961,221.12

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 579 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
can_compress_scripts
theysaidso_admin_options
gcs_use_https_for_media

Browser metrics Passed 4 tests

Checking browser requirements for Google Cloud Storage plugin
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,794 ▲5914.48 ▲0.101.65 ▼0.0837.40 ▼9.48
Dashboard /wp-admin2,210 ▲195.88 ▼0.0593.70 ▼8.7236.86 ▼6.99
Posts /wp-admin/edit.php2,090 ▲11.94 ▼0.0431.70 ▼8.7833.12 ▼3.08
Add New Post /wp-admin/post-new.php1,516 ▼2021.60 ▼1.46609.53 ▼23.7455.09 ▲2.77
Media Library /wp-admin/upload.php1,386 ▼24.16 ▼0.0995.41 ▼0.8241.82 ▲0.24
GCS /wp-admin/options-general.php?page=gcs8172.0231.0632.87

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
The following items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • gcs_use_https_for_media
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/gcs/Uploads/Uploads.php
  • 263× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerInterface' not found in wp-content/plugins/gcs/vendor/monolog/monolog/src/Monolog/Logger.php:28
    • > PHP Fatal error
      Uncaught Error: Interface 'Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/gcs/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Cloud\\Core\\Testing\\TestHelpers' not found in wp-content/plugins/gcs/vendor/google/cloud-core/snippet-bootstrap.php:5
    • > PHP Warning
      include(): Failed opening 'vendor/autoload.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/gcs/vendor/google/crc32/tests/GoogleTest.php on line 18
    • > PHP Fatal error
      Trait 'Google\\Cloud\\Core\\Batch\\BatchDaemonTrait' not found in wp-content/plugins/gcs/vendor/google/cloud-core/src/Batch/BatchRunner.php on line 30
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/gcs/vendor/guzzlehttp/psr7/src/MultipartStream.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/gcs/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php:22
    • > PHP Fatal error
      Trait 'Google\\Cloud\\Core\\ArrayTrait' not found in wp-content/plugins/gcs/vendor/google/cloud-core/src/RestTrait.php on line 25
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/gcs/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Formatter\ormalizerFormatter' not found in wp-content/plugins/gcs/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php:20

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Requires at least: The plugin version is formatted incorrectly
The official readme.txt is a good inspiration

gcs/gcs.php 85% from 13 tests

The main file in "Google Cloud Storage plugin" v. 0.1.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin60,013 lines of code in 546 files:
LanguageFilesBlank linesComment linesLines of code
PHP4727,17025,21247,567
JSON28407,135
Markdown321,56804,766
XSLT22320209
C23570132
make2171651
YAML211244
m41111438
C/C++ Header1101825
XML10019
Bourne Shell261617
Dockerfile18010

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity9.42
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity2.55
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces59
Interfaces45
Traits46
Classes338
▷ Abstract classes133.85%
▷ Concrete classes32596.15%
▷ Final classes288.62%
Methods2,443
▷ Static methods2349.58%
▷ Public methods1,86476.30%
▷ Protected methods1978.06%
▷ Private methods38215.64%
Functions247
▷ Named functions8735.22%
▷ Anonymous functions16064.78%
Constants313
▷ Global constants5015.97%
▷ Class constants26384.03%
▷ Public constants24392.40%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin