94% ban-hammer

Code Review | Ban Hammer

WordPress plugin Ban Hammer scored 94% from 54 tests.

About plugin

  • Plugin page: ban-hammer
  • Plugin version: 2.8
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-5.8
  • WordPress version: 5.9.2
  • First release: May 3, 2009
  • Latest release: Jul 29, 2021
  • Number of updates: 120
  • Update frequency: every 37.3 days
  • Top authors: Ipstenu (100%)

Code review

54 tests

User reviews

39 reviews

Install metrics

8,000+ active / 82,802 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.06MB] [CPU: ▼289.00ms] Passed 4 tests

Analyzing server-side resources used by Ban Hammer
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1461.48 ▲2.73
Dashboard /wp-admin3.50 ▲0.0934.11 ▼0.68
Posts /wp-admin/edit.php3.72 ▲0.0838.33 ▲2.38
Add New Post /wp-admin/post-new.php6.96 ▼0.0195.86 ▼1,160.43
Media Library /wp-admin/upload.php3.38 ▲0.0827.16 ▲2.81
Ban Hammer /wp-admin/tools.php?page=ban-hammer3.3428.06

Server storage [IO: ▲0.03MB] [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: 5 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Ban Hammer
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,800 ▲4616.19 ▲1.056.11 ▼0.532.62 ▼0.25
Dashboard /wp-admin2,897 ▲396.16 ▲0.02118.99 ▼28.12226.82 ▼40.56
Posts /wp-admin/edit.php2,696 ▲113.24 ▲0.02101.15 ▲36.46166.68 ▲18.56
Add New Post /wp-admin/post-new.php1,775 ▲8521.81 ▲1.18457.90 ▲0.07161.75 ▼43.15
Media Library /wp-admin/upload.php1,703 ▲55.42 ▼0.15148.37 ▼8.37192.21 ▲0.03
Ban Hammer /wp-admin/tools.php?page=ban-hammer1,0512.4994.50120.63

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ban-hammer/ban-hammer.php:65

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots do not have images: #4 (Users Menu, with Spammer Flag on), #5 (BuddyPress Error message)
The official readme.txt is a good inspiration

ban-hammer/ban-hammer.php Passed 13 tests

The main PHP script in "Ban Hammer" version 2.8 is automatically included on every request by WordPress
56 characters long description:
Prevent people from registering with any email you list.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected304 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP285200293
XML10011

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity55.00
▷ Minimum class complexity55.00
▷ Maximum class complexity55.00
Average method complexity3.57
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods21
▷ Static methods00.00%
▷ Public methods21100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
No PNG files were detected