88% fraudlabs-pro-for-woocommerce

Code Review | FraudLabs Pro for WooCommerce

WordPress plugin FraudLabs Pro for WooCommerce scored 88% from 54 tests.

About plugin

  • Plugin page: fraudlabs-pro-for...
  • Plugin version: 2.16.12
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-5.8
  • WordPress version: 5.8.1
  • First release: Jul 20, 2014
  • Latest release: Nov 2, 2021
  • Number of updates: 267
  • Update frequency: every 10.0 days
  • Top authors: fraudlabspro (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

700+ active / 33,610 total downloads


Plugin footprint Passed 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: ▼142.09ms] 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 /2.83 ▲0.1236.06 ▲3.77
Dashboard /wp-admin3.06 ▲0.0040.23 ▼10.54
Posts /wp-admin/edit.php3.11 ▲0.0049.81 ▲9.93
Add New Post /wp-admin/post-new.php5.42 ▼0.0294.04 ▼556.76
Media Library /wp-admin/upload.php3.00 ▲0.0032.22 ▼4.84

Server storage [IO: ▲0.22MB] [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, no new options

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 /3,702 ▲12015.88 ▲0.288.04 ▼2.0549.25 ▼5.87
Dashboard /wp-admin2,973 ▲425.86 ▼0.29141.83 ▼12.72110.07 ▼14.34
Posts /wp-admin/edit.php2,739 ▼02.69 ▼0.0071.75 ▲1.4592.55 ▼9.34
Add New Post /wp-admin/post-new.php1,683 ▼018.74 ▲0.01410.06 ▲15.47114.74 ▲5.79
Media Library /wp-admin/upload.php1,810 ▼05.01 ▲0.02164.83 ▲15.51123.16 ▲1.26

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

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/example.php
    • > /wp-content/plugins/fraudlabs-pro-for-woocommerce/vendor/fraudlabspro/fraudlabspro-php/tests/bootstrap.php
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > 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
    • > 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
      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

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


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: woocommerce fraud detection, fraudlabspro, fraud, fraud prevention, fraud detection...

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

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

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,327 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code

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 126)
Cyclomatic complexity
Average complexity per logical line of code0.67
Average class complexity48.36
▷ Minimum class complexity1.00
▷ Maximum class complexity389.00
Average method complexity7.51
▷ Minimum method complexity1.00
▷ Maximum method complexity126.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
▷ Static methods56.17%
▷ Public methods6985.19%
▷ Protected methods00.00%
▷ Private methods1214.81%
▷ Named functions375.00%
▷ Anonymous functions125.00%
▷ 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-end.png19.20KB9.46KB▼ 50.74%
assets/images/logo_200.png4.23KB2.45KB▼ 42.05%
assets/images/step-2-selected.png3.89KB1.82KB▼ 53.23%
assets/images/step-1-selected.png3.01KB1.35KB▼ 55.06%