52% tencentcloud-cos

Code Review | 腾讯云对象存储(COS)

WordPress plugin 腾讯云对象存储(COS) scored 52% from 54 tests.

About plugin

  • Plugin page: tencentcloud-cos
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-5.8
  • WordPress version: 5.9.2
  • First release: Jul 22, 2020
  • Latest release: Dec 31, 2021
  • Number of updates: 13
  • Update frequency: every 40.5 days
  • Top authors: chahuang (100%)

Code review

54 tests

User reviews

1 review

Install metrics

900+ active / 9,968 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼299.56ms] Passed 4 tests

Server-side resources used by 腾讯云对象存储(COS)
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.5051.13 ▲31.35
Dashboard /wp-admin3.46 ▲0.0534.85 ▲0.14
Posts /wp-admin/edit.php3.68 ▲0.0539.19 ▼0.09
Add New Post /wp-admin/post-new.php6.99 ▲0.0291.28 ▼1,198.60
Media Library /wp-admin/upload.php3.41 ▲0.1126.34 ▲0.31
腾讯云设置 /wp-admin/admin.php?page=TencentWordpressPluginsCommonSettingPage3.3228.05
对象存储 /wp-admin/admin.php?page=tencent_wordpress_plugin_cos3.5324.34

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 614 new files
Database: 1 new table, 2 new options
New tables
wp_tencent_wordpress_options
New WordPress options
tencent_wordpress_common_options
tencent_wordpress_cos_options

Browser metrics Passed 4 tests

Checking browser requirements for 腾讯云对象存储(COS)
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,818 ▲6515.75 ▲0.086.39 ▼0.212.71 ▼0.19
Dashboard /wp-admin2,915 ▲606.06 ▼0.17119.29 ▼17.99176.95 ▲17.74
Posts /wp-admin/edit.php2,725 ▲373.26 ▲0.0363.70 ▲0.34151.11 ▲9.67
Add New Post /wp-admin/post-new.php1,692 ▼2519.29 ▼2.09383.21 ▼72.43158.63 ▼1.78
Media Library /wp-admin/upload.php1,750 ▲525.57 ▲0.07135.95 ▼7.10213.00 ▲24.60
腾讯云设置 /wp-admin/admin.php?page=TencentWordpressPluginsCommonSettingPage1,3282.5758.98194.71
对象存储 /wp-admin/admin.php?page=tencent_wordpress_plugin_cos1,9832.8759.88194.97

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/tencentcloud-cos/uninstall.php+32
    Undefined index: upload_url_path
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_tencent_wordpress_options
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • tencent_wordpress_common_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=TencentWordpressPluginsCommonSettingPage
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 0% 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
Almost there! Just fix the following items
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/tencentcloud-cos/tencentcloud-plugin-cos-setting-page.php
    • > /wp-content/plugins/tencentcloud-cos/tencentcloud-cos.php
    • > /wp-content/plugins/tencentcloud-cos/common/tencent-wordpress-plugins-setting-page.php
  • 465× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Command\\Guzzle\\ResponseLocation\\AbstractLocation' not found in wp-content/plugins/tencentcloud-cos/includes/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/BodyLocation.php:11
    • > PHP Warning
      Use of undefined constant QCLOUDAPI_ROOT_PATH - assumed 'QCLOUDAPI_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/tencentcloud-cos/common/vendor/tencentcloud/tencentcloud-sdk-php/src/QcloudApi/Common/Request.php on line 2
    • > PHP Warning
      require_once(QCLOUDAPI_ROOT_PATH/Module/Base.php): failed to open stream: No such file or directory in wp-content/plugins/tencentcloud-cos/common/vendor/tencentcloud/tencentcloud-sdk-php/src/QcloudApi/Module/Cdn.php on line 2
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/tencentcloud-cos/common/vendor/guzzlehttp/promises/src/FulfilledPromise.php:10
    • > PHP Warning
      require_once(QCLOUDAPI_ROOT_PATH/Common/Sign.php): failed to open stream: No such file or directory in wp-content/plugins/tencentcloud-cos/common/vendor/tencentcloud/tencentcloud-sdk-php/src/QcloudApi/Common/Request.php on line 2
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/tencentcloud-cos/includes/vendor/qcloud/cos-sdk-v5/sample/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/tencentcloud-cos/includes/vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Exception\\GuzzleException' not found in wp-content/plugins/tencentcloud-cos/common/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php:4
    • > PHP Warning
      Use of undefined constant QCLOUDAPI_ROOT_PATH - assumed 'QCLOUDAPI_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/tencentcloud-cos/common/vendor/tencentcloud/tencentcloud-sdk-php/src/QcloudApi/Module/Scaling.php on line 2
    • > PHP Warning
      require(wp-content/plugins/tencentcloud-cos/includes/vendor/qcloud/cos-sdk-v5/sample/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/tencentcloud-cos/includes/vendor/qcloud/cos-sdk-v5/sample/listBucket.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/tencentcloud-cos/includes/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% 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
These attributes need to be fixed:
  • Requires php: The plugin version is formatted incorrectly
You can look at the official readme.txt

tencentcloud-cos/tencentcloud-cos.php 92% from 13 tests

The main PHP file in "腾讯云对象存储(COS)" ver. 1.0.4 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 156 characters long)

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
Success! There were no dangerous files found in this plugin45,451 lines of code in 451 files:
LanguageFilesBlank linesComment linesLines of code
PHP3995,41814,84337,798
Markdown221,85905,666
JSON19001,597
JavaScript13816288
YAML27033
XML20029
make29019
Dockerfile18010
HTML1109
CSS20262

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity11.70
▷ Minimum class complexity1.00
▷ Maximum class complexity153.00
Average method complexity2.73
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces35
Interfaces51
Traits7
Classes378
▷ Abstract classes61.59%
▷ Concrete classes37298.41%
▷ Final classes277.26%
Methods2,753
▷ Static methods33712.24%
▷ Public methods2,31784.16%
▷ Protected methods441.60%
▷ Private methods39214.24%
Functions502
▷ Named functions21643.03%
▷ Anonymous functions28656.97%
Constants282
▷ Global constants6824.11%
▷ Class constants21475.89%
▷ Public constants214100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG images were found in this plugin