78% sargas-recaptcha

Code Review | Sargas reCAPTCHA

WordPress plugin Sargas reCAPTCHA scored78%from 54 tests.

About plugin

  • Plugin page: sargas-recaptcha
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.2.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Jan 28, 2023
  • Latest release: Apr 6, 2023
  • Number of updates: 4
  • Update frequency: every 17.2 days
  • Top authors: sargasinc (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /579 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.46MB] [CPU: ▼5.44ms] Passed 4 tests

Analyzing server-side resources used by Sargas reCAPTCHA
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.89 ▲0.4249.06 ▲7.71
Dashboard /wp-admin3.79 ▲0.4452.12 ▼14.49
Posts /wp-admin/edit.php3.83 ▲0.4748.06 ▲2.56
Add New Post /wp-admin/post-new.php6.49 ▲0.6087.36 ▼11.24
Media Library /wp-admin/upload.php3.75 ▲0.5135.91 ▲1.43

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Sargas reCAPTCHA
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,891 ▲12013.18 ▼1.181.93 ▼0.4540.35 ▼2.12
Dashboard /wp-admin2,275 ▲875.93 ▲0.82104.72 ▼13.1139.79 ▼9.13
Posts /wp-admin/edit.php2,155 ▲662.05 ▲0.0240.62 ▲4.8336.21 ▼1.66
Add New Post /wp-admin/post-new.php1,557 ▲3818.24 ▼5.08631.31 ▲25.0154.99 ▲2.32
Media Library /wp-admin/upload.php1,452 ▲704.28 ▲0.0396.64 ▼3.3641.48 ▼3.29

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
Please fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/index.php
  • 26× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/recaptcha-v3-verify.php on line 38
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/recaptcha-v3-request-scores.php on line 38
    • > PHP Fatal error
      Uncaught Error: Class 'NF_Abstracts_Input' not found in wp-content/plugins/sargas-recaptcha/includes/Forms/Ninja_Forms/Ninja_Forms_Custom_Field.php:15
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/sargas-recaptcha/includes/Config/Initial_Value.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/SocketPostTest.php:41
    • > PHP Warning
      require_once(wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/examples/recaptcha-v2-invisible.php on line 38
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestParametersTest.php:39
    • > PHP Fatal error
      Uncaught Error: Interface 'ReCaptcha\\RequestMethod' not found in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php:46
    • > PHP Fatal error
      Uncaught Error: Interface 'ReCaptcha\\RequestMethod' not found in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php:46
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/sargas-recaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/PostTest.php:41

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (General settings page.), #2 (Standard forms settings page.), #3 (WooCommerce forms settings page.), #4 (Mailchimp for WordPress settings page.), #5 (Login form with reCAPTCHA v2.), #6 (Login form with reCAPTCHA v3.), #7 (Registration form with reCAPTCHA v2.), #8 (Registration form with reCAPTCHA v3.), #9 (Lost password form with reCAPTCHA v2.), #10 (Lost password form with reCAPTCHA v3.), #11 (Comment form with reCAPTCHA v2.), #12 (Comment form with reCAPTCHA v3.), #13 (WooCommerce login and registration with reCAPTCHA v2.), #14 (WooCommerce login and registration with reCAPTCHA v3.), #15 (WooCommerce lost password form with reCAPTCHA v2.), #16 (WooCommerce lost password form with reCAPTCHA v3.), #17 (WooCommerce checkout form with reCAPTCHA v2.), #18 (WooCommerce checkout form with reCAPTCHA v3.), #19 (Mailchimp for WordPress form with reCAPTCHA v2.), #20 (Mailchimp for WordPress form with reCAPTCHA v3.), #21 (reCAPTCHA v2 widget preview.), #22 (Message about successful reCAPTCHA v2 key verification.), #23 (reCAPTCHA v3 widget preview.), #24 (Message about successful reCAPTCHA v3 key verification.), #25 (Ninja Forms settings page.), #26 (Ninja Forms builder with Sargas reCAPTCHA custom field.), #27 (Contact Us form by Ninja Forms with reCAPTCHA v2.), #28 (Contact Us form by Ninja Forms with reCAPTCHA v3.), #29 (Gravity Forms settings page.), #30 (Contact form by Gravity Forms with reCAPTCHA v2.), #31 (Contact form by Gravity Forms with reCAPTCHA v3.)
Please take inspiration from this readme.txt

sargas-recaptcha/sargas-recaptcha.php Passed 13 tests

The main PHP script in "Sargas reCAPTCHA" version 1.0.2 is automatically included on every request by WordPress
80 characters long description:
Protect your WordPress forms against spam and brute-force using Sargas reCAPTCHA

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin5,593 lines of code in 96 files:
LanguageFilesBlank linesComment linesLines of code
PHP751,0002,2574,481
PO File2124182322
JavaScript5456258
CSS3321179
JSON300128
Markdown223090
SVG10177
YAML210031
XML10020
HTML2007

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity5.89
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.05
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces16
Interfaces3
Traits1
Classes53
▷ Abstract classes611.32%
▷ Concrete classes4788.68%
▷ Final classes12.13%
Methods277
▷ Static methods2810.11%
▷ Public methods25792.78%
▷ Protected methods51.81%
▷ Private methods155.42%
Functions12
▷ Named functions18.33%
▷ Anonymous functions1191.67%
Constants29
▷ Global constants1551.72%
▷ Class constants1448.28%
▷ Public constants14100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
32 PNG files occupy 4.22MB with 3.35MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-28.png148.82KB36.39KB▼ 75.55%
screenshot-13.png153.86KB36.81KB▼ 76.07%
screenshot-22.png170.84KB41.32KB▼ 75.81%
screenshot-5.png98.55KB15.20KB▼ 84.58%
screenshot-6.png98.42KB14.86KB▼ 84.90%