83% obs-huaweicloud

Code Review | OBS HuaWeiCloud

WordPress plugin OBS HuaWeiCloud scored83%from 54 tests.

About plugin

  • Plugin page: obs-huaweicloud
  • Plugin version: 1.3.0
  • PHP compatiblity: 7.0.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.3
  • WordPress version: 6.3.1
  • First release: Mar 26, 2020
  • Latest release: Aug 1, 2023
  • Number of updates: 16
  • Update frequency: every 76.5 days
  • Top authors: shenyanzhi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /5,243 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: ▲0.32MB] [CPU: ▼5.24ms] Passed 4 tests

A check of server-side resources used by OBS HuaWeiCloud
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3745.80 ▲7.55
Dashboard /wp-admin3.67 ▲0.3246.71 ▼15.27
Posts /wp-admin/edit.php3.72 ▲0.3647.15 ▲0.33
Add New Post /wp-admin/post-new.php6.19 ▲0.3084.36 ▼11.27
Media Library /wp-admin/upload.php3.53 ▲0.3039.74 ▲5.27
华为云OBS设置 /wp-admin/options-general.php?page=obs-huaweicloud/huaweicloud-obs-wordpress.php3.4930.81

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 336 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
obs_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for OBS HuaWeiCloud
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.53 ▲0.161.92 ▲0.1244.06 ▼2.09
Dashboard /wp-admin2,199 ▲195.63 ▼0.0282.86 ▼14.7443.60 ▼1.74
Posts /wp-admin/edit.php2,104 ▲42.03 ▲0.0236.94 ▼2.7639.25 ▲4.79
Add New Post /wp-admin/post-new.php1,529 ▲323.11 ▲0.17686.38 ▼7.4558.99 ▼2.44
Media Library /wp-admin/upload.php1,401 ▲14.19 ▲0.01101.73 ▲1.2449.01 ▲3.29
华为云OBS设置 /wp-admin/options-general.php?page=obs-huaweicloud/huaweicloud-obs-wordpress.php1,1812.1623.0286.48

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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
  • 151× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/guzzlehttp/psr7/src/NoSeekStream.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Obs\\Internal\\Signature\\AbstractSignature' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/obs/esdk-obs-php/Obs/Internal/Signature/V4Signature.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/obs-huaweicloud/huaweicloud-obs-wordpress.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\MailHandler' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Logger' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/obs/esdk-obs-php/Obs/ObsClient.php:34
    • > PHP Fatal error
      Uncaught Error: Interface 'Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/obs-huaweicloud/sdk/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php:22
    • > PHP Fatal error
      Cannot declare class TypeError, because the name is already in use in wp-content/plugins/obs-huaweicloud/sdk/vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (screenshot-1.png), #2 (screenshot-2.png)
Please take inspiration from this readme.txt

obs-huaweicloud/huaweicloud-obs-wordpress.php 85% from 13 tests

The primary PHP file in "OBS HuaWeiCloud" version 1.3.0 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("obs-huaweicloud.php" instead of "huaweicloud-obs-wordpress.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 164 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected52,054 lines of code in 313 files:
LanguageFilesBlank linesComment linesLines of code
PHP2764,84411,47446,484
Markdown191,33803,973
JSON15101,565
XML10019
Dockerfile18010
Bourne Shell1203

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity14.43
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity3.18
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces30
Interfaces28
Traits8
Classes204
▷ Abstract classes83.92%
▷ Concrete classes19696.08%
▷ Final classes2512.76%
Methods1,517
▷ Static methods21814.37%
▷ Public methods1,10672.91%
▷ Protected methods16610.94%
▷ Private methods24516.15%
Functions215
▷ Named functions9142.33%
▷ Anonymous functions12457.67%
Constants292
▷ Global constants5318.15%
▷ Class constants23981.85%
▷ Public constants239100.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
2 PNG files occupy 0.37MB with 0.26MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png61.75KB19.51KB▼ 68.41%
screenshot-1.png317.00KB94.95KB▼ 70.05%