84% comment-guardian

Code Review | Comment Guardian – Remove Comment Spam by Language Detection

WordPress plugin Comment Guardian – Remove Comment Spam by Language Detection scored84%from 54 tests.

About plugin

  • Plugin page: comment-guardian
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.0
  • WordPress version: 6.3.1
  • First release: Jul 24, 2021
  • Latest release: May 30, 2022
  • Number of updates: 6
  • Update frequency: every 51.8 days
  • Top authors: Bloodspencer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /587 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.12MB] [CPU: ▼3.65ms] Passed 4 tests

A check of server-side resources used by Comment Guardian – Remove Comment Spam by Language Detection
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1140.57 ▼0.18
Dashboard /wp-admin3.42 ▲0.1152.74 ▼4.92
Posts /wp-admin/edit.php3.53 ▲0.1754.89 ▲1.09
Add New Post /wp-admin/post-new.php6.02 ▲0.1385.37 ▼10.58
Media Library /wp-admin/upload.php3.34 ▲0.1137.94 ▲2.13
Comment Guardian /wp-admin/options-general.php?page=comment-guardian-options3.3135.36

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 266 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
cg_version
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Comment Guardian – Remove Comment Spam by Language Detection
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,841 ▲7013.21 ▼1.174.45 ▲2.5141.73 ▲0.20
Dashboard /wp-admin2,208 ▲205.83 ▼0.08101.08 ▼7.1539.15 ▼8.35
Posts /wp-admin/edit.php2,097 ▲112.05 ▲0.0439.77 ▲3.4034.74 ▲0.54
Add New Post /wp-admin/post-new.php1,538 ▲2423.19 ▲5.55673.31 ▼19.9464.85 ▲6.75
Media Library /wp-admin/upload.php1,396 ▲144.19 ▲0.0497.47 ▼4.7345.80 ▼0.81
Comment Guardian /wp-admin/options-general.php?page=comment-guardian-options1,2961.8728.2135.67

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • cg_version

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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 5× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/comment-guardian/includes/class-comment-guardian-activator.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/comment-guardian/admin/partials/comment-guardian-admin-display.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'LanguageDetection\\Tokenizer\\TokenizerInterface' not found in wp-content/plugins/comment-guardian/includes/LanguageDetection/Tokenizer/WhitespaceTokenizer.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'LanguageDetection\gramParser' not found in wp-content/plugins/comment-guardian/includes/LanguageDetection/Trainer.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'LanguageDetection\gramParser' not found in wp-content/plugins/comment-guardian/includes/LanguageDetection/Language.php:14

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 Passed 29 tests

readme.txt Passed 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
4 plugin tags: spam protection, spam, remove spam, comments

comment-guardian/comment-guardian.php Passed 13 tests

"Comment Guardian – Remove Comment Spam by Language Detection" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
113 characters long description:
Comment Guardian is an innovative and intelligent spam protection that eliminates comment spam 99.9% of the time.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin37,562 lines of code in 139 files:
LanguageFilesBlank linesComment linesLines of code
PHP13030962136,933
PO File44844209
JavaScript2221190
Sass12083
CSS116182
Markdown14065

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity4.83
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.88
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces2
Interfaces1
Traits0
Classes11
▷ Abstract classes19.09%
▷ Concrete classes1090.91%
▷ Final classes00.00%
Methods53
▷ Static methods23.77%
▷ Public methods4686.79%
▷ Protected methods11.89%
▷ Private methods611.32%
Functions4
▷ Named functions250.00%
▷ Anonymous functions250.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.09MB with 0.04MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/img/comment-guardian.png96.63KB59.33KB▼ 38.60%