78% fraudlabs-pro-for-woocommerce

Code Review | FraudLabs Pro for WooCommerce

WordPress plugin FraudLabs Pro for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: fraudlabs-pro-for...
  • Plugin version: 2.18.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4
  • WordPress version: 6.3.1
  • First release: Jul 20, 2014
  • Latest release: Nov 30, 2023
  • Number of updates: 324
  • Update frequency: every 10.6 days
  • Top authors: fraudlabspro (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

700+ active /51,474 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

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

A check of server-side resources used by FraudLabs Pro for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.62 ▼2.91
Dashboard /wp-admin3.31 ▲0.0049.53 ▼2.49
Posts /wp-admin/edit.php3.36 ▲0.0046.07 ▼3.10
Add New Post /wp-admin/post-new.php5.89 ▲0.0092.22 ▼5.28
Media Library /wp-admin/upload.php3.23 ▲0.0031.89 ▲0.80

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 36 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for FraudLabs Pro for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.24 ▼0.121.71 ▲0.0336.08 ▼6.99
Dashboard /wp-admin2,198 ▲175.64 ▲0.0596.48 ▼19.7241.62 ▼0.63
Posts /wp-admin/edit.php2,103 ▼01.95 ▼0.0640.70 ▲0.8835.62 ▼1.87
Add New Post /wp-admin/post-new.php1,526 ▼523.61 ▲0.54600.27 ▼34.3956.58 ▲6.54
Media Library /wp-admin/upload.php1,403 ▲64.18 ▲0.0195.12 ▼13.1742.28 ▼0.61

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts

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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/tests/bootstrap.php
    • > /wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/example.php
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/fraudlabs-pro-for-woocommerce/includes/flp-callback.php:9
    • > PHP Warning
      require_once(wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/example.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/tests/FraudValidationTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/tests/SmsVerificationTest.php:7
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/example.php on line 6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
7 plugin tags: fraudlabspro, fraud detection, fraud prevention, woocommerce fraud detection, woocommerce...

fraudlabs-pro-for-woocommerce/init.php 85% from 13 tests

The primary PHP file in "FraudLabs Pro for WooCommerce" version 2.18.5 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("fraudlabs-pro-for-woocommerce.php" instead of "init.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 146 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected3,525 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP185624333,109
Markdown1670189
JavaScript2230139
JSON20074
CSS1107
XML1007

PHP code 50% from 2 tests

Analyzing 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 138)
Cyclomatic complexity
Average complexity per logical line of code0.69
Average class complexity52.73
▷ Minimum class complexity1.00
▷ Maximum class complexity437.00
Average method complexity7.77
▷ Minimum method complexity1.00
▷ Maximum method complexity138.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods85
▷ Static methods55.88%
▷ Public methods7385.88%
▷ Protected methods00.00%
▷ Private methods1214.12%
Functions4
▷ Named functions375.00%
▷ Anonymous functions125.00%
Constants18
▷ Global constants316.67%
▷ Class constants1583.33%
▷ Public constants15100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
7 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/step-2.png4.88KB1.81KB▼ 62.92%
assets/images/step-1.png4.04KB1.52KB▼ 62.47%
assets/images/step-2-selected.png3.89KB1.82KB▼ 53.23%
assets/images/logo_200.png4.23KB2.45KB▼ 42.05%
assets/images/step-1-selected.png3.01KB1.35KB▼ 55.06%