89% wp-weixin

Code Review | WP Weixin

WordPress plugin WP Weixin scored89%from 54 tests.

About plugin

  • Plugin page: wp-weixin
  • Plugin version: 1.3.16
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.5-6.4
  • WordPress version: 6.3.1
  • First release: Apr 29, 2018
  • Latest release: Nov 11, 2023
  • Number of updates: 45
  • Update frequency: every 44.9 days
  • Top authors: frogerme (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

400+ active /12,818 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.34MB] [CPU: ▲5.36ms] Passed 4 tests

An overview of server-side resources used by WP Weixin
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.83 ▲1.3750.40 ▲13.17
Dashboard /wp-admin4.69 ▲1.3552.11 ▼6.62
Posts /wp-admin/edit.php4.74 ▲1.3954.50 ▲11.42
Add New Post /wp-admin/post-new.php7.21 ▲1.3297.32 ▲3.45
Media Library /wp-admin/upload.php4.55 ▲1.3250.97 ▲15.46

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Weixin
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4314.25 ▼0.102.07 ▲0.4942.24 ▲2.28
Dashboard /wp-admin2,201 ▲205.56 ▼0.0991.21 ▼6.6663.88 ▲13.13
Posts /wp-admin/edit.php2,118 ▲181.95 ▼0.0038.98 ▲3.4134.00 ▲2.25
Add New Post /wp-admin/post-new.php1,692 ▲16622.49 ▼0.32643.96 ▼39.6345.74 ▼6.76
Media Library /wp-admin/upload.php1,415 ▲154.21 ▲0.00101.30 ▼7.8769.50 ▲23.40

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments

Smoke tests Passed 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)
Everything seems fine, however this is by no means an exhaustive test

SRP Passed 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
Looking good! No server-side errors or output on direct access of PHP files

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 Passed 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: wechat share, wechat

wp-weixin/wp-weixin.php Passed 13 tests

The entry point to "WP Weixin" version 1.3.16 is a PHP file that has certain tags in its header comment area
28 characters long description:
WordPress WeChat integration

Code Analysis 97% from 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 plugin11,947 lines of code in 49 files:
LanguageFilesBlank linesComment linesLines of code
PHP302,3231,2829,020
Markdown148501,276
JavaScript813134679
PO File1186228583
CSS8580388
SVG1001

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 288)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity56.90
▷ Minimum class complexity1.00
▷ Maximum class complexity513.00
Average method complexity5.13
▷ Minimum method complexity1.00
▷ Maximum method complexity288.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes29
▷ Abstract classes00.00%
▷ Concrete classes29100.00%
▷ Final classes00.00%
Methods393
▷ Static methods9223.41%
▷ Public methods32281.93%
▷ Protected methods4110.43%
▷ Private methods307.63%
Functions20
▷ Named functions1890.00%
▷ Anonymous functions210.00%
Constants97
▷ Global constants3738.14%
▷ Class constants6061.86%
▷ Public constants60100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/qr-placeholder.png3.30KB1.17KB▼ 64.69%
images/default-welcome.png11.11KB3.20KB▼ 71.22%
images/wechat.png3.58KB0.97KB▼ 72.91%
(invalid) images/default-avatar.png1.49KB0.00KB▼ 100.00%