84% baidu-textcensor

Code Review | Baidu TextCensor For Comments

WordPress plugin Baidu TextCensor For Comments scored84%from 54 tests.

About plugin

  • Plugin page: baidu-textcensor
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.3
  • WordPress version: 6.3.1
  • First release: Jan 9, 2020
  • Latest release: Jul 22, 2023
  • Number of updates: 35
  • Update frequency: every 36.9 days
  • Top authors: shenyanzhi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /2,308 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼5.78ms] Passed 4 tests

Server-side resources used by Baidu TextCensor For Comments
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.56 ▼3.77
Dashboard /wp-admin3.31 ▲0.0149.77 ▼5.82
Posts /wp-admin/edit.php3.36 ▲0.0148.81 ▼2.53
Add New Post /wp-admin/post-new.php5.89 ▲0.0192.02 ▼7.69
Media Library /wp-admin/upload.php3.24 ▲0.0134.62 ▼5.84
评论内容审核设置 /wp-admin/options-general.php?page=Baidu_Text_Censor3.2031.95

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 8 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
BaiduTextCensor
can_compress_scripts
widget_recent-posts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Baidu TextCensor For Comments
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.34 ▼0.011.89 ▲0.1043.80 ▲0.28
Dashboard /wp-admin2,199 ▲195.54 ▼0.0487.25 ▼8.3743.27 ▼1.47
Posts /wp-admin/edit.php2,107 ▲72.02 ▲0.0540.83 ▲0.0039.87 ▲5.94
Add New Post /wp-admin/post-new.php1,529 ▲323.26 ▼0.31619.33 ▼25.2650.44 ▼0.10
Media Library /wp-admin/upload.php1,398 ▼54.22 ▲0.0697.98 ▼8.8252.06 ▲2.37
评论内容审核设置 /wp-admin/options-general.php?page=Baidu_Text_Censor8822.1222.8668.38

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
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
The following issues need your attention
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/baidu-textcensor/wp-baidu-textcensor.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues 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
Please fix the following attributes:
  • Screenshots: Screenshot #1 (screenshot-1.png) image missing
The official readme.txt might help

baidu-textcensor/wp-baidu-textcensor.php 92% from 13 tests

The main PHP file in "Baidu TextCensor For Comments" ver. 1.1.0 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("baidu-textcensor.php" instead of "wp-baidu-textcensor.php")

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 detected367 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP347104334
Markdown127033

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity24.00
▷ Minimum class complexity24.00
▷ Maximum class complexity24.00
Average method complexity3.30
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods330.00%
▷ Protected methods330.00%
▷ Private methods440.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.22MB with 0.15MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png228.37KB72.13KB▼ 68.42%