68% fail2wp

Code Review | Fail2WP

WordPress plugin Fail2WP scored68%from 54 tests.

About plugin

  • Plugin page: fail2wp
  • Plugin version: 1.2.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-6.3
  • WordPress version: 6.3.1
  • First release: Feb 8, 2021
  • Latest release: Aug 9, 2023
  • Number of updates: 15
  • Update frequency: every 61.1 days
  • Top authors: joho68 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

80+ active /1,016 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.10MB] [CPU: ▼6.15ms] Passed 4 tests

An overview of server-side resources used by Fail2WP
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0544.28 ▲0.98
Dashboard /wp-admin3.43 ▲0.0958.53 ▼8.19
Posts /wp-admin/edit.php3.48 ▲0.1357.57 ▲8.05
Add New Post /wp-admin/post-new.php6.01 ▲0.1392.88 ▼7.50
Media Library /wp-admin/upload.php3.35 ▲0.1244.17 ▼9.88
Fail2WP /wp-admin/options-general.php?page=fail2wp3.3240.30

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 32 new files
Database: no new tables, 21 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
fail2wp-roles-warn
fail2wp-loginip-deny
fail2wp-reguser-useremail-require
fail2wp-rest-filter-ipv4-bypass
fail2wp-roles-notify
fail2wp-cloudflare-ipv4
widget_recent-posts
db_upgraded
...

Browser metrics Passed 4 tests

Fail2WP: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3414.27 ▼0.071.67 ▼0.0741.10 ▼1.83
Dashboard /wp-admin2,204 ▲275.56 ▼0.0489.32 ▲1.7737.39 ▼3.49
Posts /wp-admin/edit.php2,106 ▲61.97 ▼0.0339.42 ▲0.8434.80 ▼1.61
Add New Post /wp-admin/post-new.php1,531 ▲323.13 ▲0.10613.71 ▼70.8151.49 ▲0.65
Media Library /wp-admin/upload.php1,406 ▲64.24 ▼0.02104.33 ▼2.2850.36 ▲5.07
Fail2WP /wp-admin/options-general.php?page=fail2wp9062.0021.7929.31

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Uninstaller has failed for this plugin, leaving 32 files (0.31MB) in the plugin directory
    • (new file) externals/index.php
    • (new file) externals/php-cidr-match-0.4/CIDRmatch/CIDRmatch.php
    • (new file) README.txt
    • (new file) FAIL2BAN.txt
    • (new file) externals/php-cidr-match-0.4/CIDRmatch/index.php
    • (new file) externals/php-cidr-match-0.4/.travis.yml
    • (new file) externals/php-cidr-match-0.4/LICENSE.txt
    • (new file) externals/php-cidr-match-0.4/.gitignore
    • (new file) LICENSE.txt
    • (new file) css/fail2wp.css
    • ...
  • The uninstall procedure has failed, leaving 21 options in the database
    • fail2wp-cloudflare-ipv4
    • widget_theysaidso_widget
    • fail2wp-rest-filter-ipv4-bypass
    • fail2wp-loginip-allow
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • fail2wp-rest-filter-block-routes
    • db_upgraded
    • fail2wp-reguser-username-ban
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/fail2wp/uninstall.php
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      require(wp-content/plugins/fail2wp/externals/php-cidr-match-0.4/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/fail2wp/externals/php-cidr-match-0.4/tests/bootstrap.php on line 3
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/fail2wp/externals/php-cidr-match-0.4/tests/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/fail2wp/externals/php-cidr-match-0.4/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/fail2wp/externals/php-cidr-match-0.4/tests/CIDRmatchTest/CIDRmatchTest.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration Passed 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
5 plugin tags: authentication, security, fail2ban, admin, firewall

fail2wp/fail2wp.php Passed 13 tests

Analyzing the main PHP file in "Fail2WP" version 1.2.0
70 characters long description:
Security plugin for WordPress with support for Fail2ban and Cloudflare

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,880 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP92199153,292
PO File1167184470
JSON10032
XML14030
CSS11329
Markdown17014
YAML13013

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity130.83
▷ Minimum class complexity1.00
▷ Maximum class complexity697.00
Average method complexity6.95
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods131
▷ Static methods10.76%
▷ Public methods11184.73%
▷ Protected methods1410.69%
▷ Private methods64.58%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants34
▷ Global constants34100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/webbplatsen_logo.png9.32KB5.62KB▼ 39.71%