67% spam-captcha

Code Review | Spam Captcha

WordPress plugin Spam Captcha scored67%from 54 tests.

About plugin

  • Plugin page: spam-captcha
  • Plugin version: 1.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Sep 17, 2011
  • Latest release: Jun 29, 2023
  • Number of updates: 59
  • Update frequency: every 73.0 days
  • Top authors: sedLex (96.61%)kaizencoders (5.08%)

Code review

54 tests

User reviews

2 reviews

Install metrics

400+ active /31,528 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.00MB] [CPU: ▼3.28ms] Passed 4 tests

Analyzing server-side resources used by Spam Captcha
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0043.46 ▼1.90
Dashboard /wp-admin3.31 ▲0.0059.36 ▲7.29
Posts /wp-admin/edit.php3.36 ▲0.0054.36 ▼2.40
Add New Post /wp-admin/post-new.php5.89 ▲0.0098.16 ▼8.10
Media Library /wp-admin/upload.php3.23 ▲0.0038.40 ▼0.72

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 208 new files
Database: 1 new table, 7 new options
New tables
wp_pluginSL_spam_captcha
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_recent-posts
db_upgraded
spam_captcha_options

Browser metrics Passed 4 tests

Checking browser requirements for Spam Captcha
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.24 ▼0.121.93 ▼0.1546.00 ▲0.13
Dashboard /wp-admin2,195 ▲185.56 ▼0.1489.65 ▼19.5846.12 ▼20.19
Posts /wp-admin/edit.php2,103 ▼02.02 ▼0.0142.13 ▼1.4239.04 ▲0.72
Add New Post /wp-admin/post-new.php1,526 ▼223.18 ▲0.36678.52 ▲38.8958.98 ▲3.82
Media Library /wp-admin/upload.php1,397 ▼34.23 ▲0.04103.67 ▼4.2845.97 ▲1.69

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method spam_captcha::uninstall_removedata() should not be called statically
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/spam-captcha/spam-captcha.php
    • > /wp-content/plugins/spam-captcha/core.php
    • > /wp-content/plugins/spam-captcha/core.class.php
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      require_once(): Failed opening required 'core.php' (include_path='.:/usr/share/php') in wp-content/plugins/spam-captcha/core/templates/my-plugin.php on line 18
    • > PHP Warning
      require_once(core.php): failed to open stream: No such file or directory in wp-content/plugins/spam-captcha/core/templates/my-plugin.php on line 18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that need to be fixed:
  • Screenshots: These screenshots require images: #1 (The result page), #2 (The configuration page of the plugin), #3 (An error when mistyping a captcha), #4 (An error when detecting a spam), #5 (Spam Report)
Please take inspiration from this readme.txt

spam-captcha/spam-captcha.php 92% from 13 tests

The main PHP script in "Spam Captcha" version 1.4.3 is automatically included on every request by WordPress
You should first fix the following items:
  • Description: Please keep the plugin description shorter than 140 characters (currently 541 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected19,614 lines of code in 92 files:
LanguageFilesBlank linesComment linesLines of code
PO File514,903010,878
PHP191,0131,8137,368
JavaScript7206241782
CSS118513471
Markdown120084
JSON10029
INI2002

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
These items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 119)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity54.47
▷ Minimum class complexity1.00
▷ Maximum class complexity211.00
Average method complexity7.39
▷ Minimum method complexity1.00
▷ Maximum method complexity119.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes19
▷ Abstract classes15.26%
▷ Concrete classes1894.74%
▷ Final classes00.00%
Methods159
▷ Static methods3522.01%
▷ Public methods15698.11%
▷ Protected methods31.89%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
39 PNG files occupy 0.66MB with 0.39MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/banner-772x250.png77.83KB23.53KB▼ 69.77%
core/img/tree_lastnode.png0.14KB0.10KB▼ 27.78%
core/img/warning.png4.46KB1.51KB▼ 66.10%
img/error.png4.24KB1.48KB▼ 65.18%
img/icon-256x256.png47.72KB17.72KB▼ 62.87%