84% wpcos

Code Review | WPCOS腾讯云对象存储COS

WordPress plugin WPCOS腾讯云对象存储COS scored84%from 54 tests.

About plugin

  • Plugin page: wpcos
  • Plugin version: 4.7.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-6.2
  • WordPress version: 6.3.1
  • First release: May 29, 2019
  • Latest release: May 13, 2023
  • Number of updates: 26
  • Update frequency: every 55.6 days
  • Top authors: laobuluo (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

1,000+ active /11,711 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▲0.35ms] Passed 4 tests

This is a short check of server-side resources used by WPCOS腾讯云对象存储COS
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0338.53 ▼1.76
Dashboard /wp-admin3.32 ▲0.0244.58 ▼1.19
Posts /wp-admin/edit.php3.37 ▲0.0247.07 ▲2.30
Add New Post /wp-admin/post-new.php5.90 ▲0.0293.39 ▲4.32
Media Library /wp-admin/upload.php3.24 ▲0.0232.74 ▲2.05
WPCOS设置 /wp-admin/options-general.php?page=wpcos/wpcos_actions.php3.2128.73

Server storage [IO: ▲3.04MB] [DB: ▲0.07MB] Passed 3 tests

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for WPCOS腾讯云对象存储COS
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4713.24 ▼1.071.65 ▼0.0338.16 ▼9.81
Dashboard /wp-admin2,210 ▲224.88 ▲0.00107.87 ▼2.6047.64 ▲2.88
Posts /wp-admin/edit.php2,093 ▲41.97 ▼0.0339.53 ▲4.5840.23 ▲5.52
Add New Post /wp-admin/post-new.php1,545 ▲1118.31 ▼4.77617.24 ▼35.3254.26 ▼1.74
Media Library /wp-admin/upload.php1,389 ▲14.17 ▼0.0995.81 ▲2.4843.82 ▲3.86
WPCOS设置 /wp-admin/options-general.php?page=wpcos/wpcos_actions.php1,3071.9033.39156.28

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 103× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/HeaderLocationTest.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\ResponseInterface' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/psr7/src/Response.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/tests/RequestLocation/JsonLocationTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Command\\Guzzle\\ResponseLocation\\AbstractLocation' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/src/ResponseLocation/HeaderLocation.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/promises/src/RejectedPromise.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/tests/SerializerTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/tests/GuzzleClientTest.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Command\\Guzzle\\RequestLocation\\AbstractLocation' not found in wp-content/plugins/wpcos/sdk/cos-php-sdk-v5/vendor/guzzlehttp/guzzle-services/src/RequestLocation/BodyLocation.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
2 plugin tags: cos, wordpress

wpcos/wpcos.php 92% from 13 tests

"WPCOS腾讯云对象存储COS" version 4.7.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 156 characters long)

Code Analysis Passed 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
No dangerous file extensions were detected27,785 lines of code in 222 files:
LanguageFilesBlank linesComment linesLines of code
PHP1812,8947,71123,200
Markdown131,26303,602
JSON800687
SVG13563195
XML20029
YAML14019
make29019
Dockerfile18010
HTML1109
JavaScript6059
CSS6046

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity11.11
▷ Minimum class complexity1.00
▷ Maximum class complexity92.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces26
Interfaces23
Traits3
Classes137
▷ Abstract classes21.46%
▷ Concrete classes13598.54%
▷ Final classes96.67%
Methods1,198
▷ Static methods756.26%
▷ Public methods1,01384.56%
▷ Protected methods322.67%
▷ Private methods15312.77%
Functions194
▷ Named functions8543.81%
▷ Anonymous functions10956.19%
Constants69
▷ Global constants45.80%
▷ Class constants6594.20%
▷ Public constants65100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.14MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
layui/images/logo.png24.44KB0.95KB▼ 96.10%
layui/css/modules/layer/default/icon.png11.22KB4.36KB▼ 61.19%
layui/images/footer_logo.png24.87KB0.95KB▼ 96.18%
layui/css/modules/layer/default/icon-ext.png5.77KB2.91KB▼ 49.62%
layui/images/qrcode.png72.54KB12.37KB▼ 82.94%