78% cf7-antispam

Code Review | AntiSpam for Contact Form 7

WordPress plugin AntiSpam for Contact Form 7 scored78%from 54 tests.

About plugin

  • Plugin page: cf7-antispam
  • Plugin version: 0.4.5
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-6.2
  • WordPress version: 6.3.1
  • First release: May 24, 2021
  • Latest release: Apr 7, 2023
  • Number of updates: 45
  • Update frequency: every 15.3 days
  • Top authors: codekraft (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

4,000+ active /14,447 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.09MB] [CPU: ▼1.39ms] Passed 4 tests

This is a short check of server-side resources used by AntiSpam for Contact Form 7
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0539.27 ▲0.56
Dashboard /wp-admin3.42 ▲0.1148.44 ▼2.92
Posts /wp-admin/edit.php3.47 ▲0.1150.03 ▼2.96
Add New Post /wp-admin/post-new.php6.00 ▲0.11103.23 ▲1.69
Media Library /wp-admin/upload.php3.34 ▲0.1137.21 ▼0.22

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 145 new files
Database: 2 new tables, 8 new options
New tables
wp_cf7a_wordlist
wp_cf7a_blacklist
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
db_upgraded
theysaidso_admin_options
cf7a_options
cf7a_db_version
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for AntiSpam for Contact Form 7
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3414.35 ▼0.011.80 ▲0.2741.28 ▼3.07
Dashboard /wp-admin2,195 ▲185.61 ▼0.0092.60 ▲2.9844.03 ▲0.28
Posts /wp-admin/edit.php2,106 ▲31.99 ▼0.0342.13 ▲2.7840.99 ▲5.41
Add New Post /wp-admin/post-new.php1,534 ▲623.41 ▲0.33667.54 ▲27.1452.31 ▼7.89
Media Library /wp-admin/upload.php1,403 ▲34.26 ▲0.15104.42 ▼13.6046.54 ▼1.76

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments

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 everything seems fine, this is not an exhaustive test

SRP 0% 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
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cf7-antispam/vendor/l3u/b8/example/index.php
  • 41× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/cf7-antispam/vendor/geoip2/geoip2/src/Record/City.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'b8\\storage\\storage_base' not found in wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/dba.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/cf7-antispam/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cf7-antispam/includes/cf7a-functions.php:137
    • > PHP Fatal error
      Uncaught Error: Class 'b8\\storage\\storage_base' not found in wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/mysql.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'GeoIp2\\ProviderInterface' not found in wp-content/plugins/cf7-antispam/vendor/geoip2/geoip2/src/Database/Reader.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\Country' not found in wp-content/plugins/cf7-antispam/vendor/geoip2/geoip2/src/Record/RepresentedCountry.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'b8\\storage\\storage_base' not found in wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/sqlite.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'MaxMind\\WebService\\Http\\Request' not found in wp-content/plugins/cf7-antispam/vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/cf7-antispam/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Screenshots: Add descriptions for screenshots #1, #2, #3, #4 in cf7-antispam/assets to your readme.txt
Please take inspiration from this readme.txt

cf7-antispam/cf7-antispam.php Passed 13 tests

The main file in "AntiSpam for Contact Form 7" v. 0.4.5 serves as a complement to information provided in readme.txt and as the entry point to the plugin
71 characters long description:
A trustworthy antispam plugin for Contact Form 7. Simple but effective.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin11,218 lines of code in 125 files:
LanguageFilesBlank linesComment linesLines of code
PHP932,0634,2667,640
Markdown84150995
C111825668
JavaScript676110536
reStructuredText229213515
JSON500439
Sass25010263
XML14059
Bourne Shell118038
m418032
Bourne Again Shell191113
SQL291810
C/C++ Header14128
CSS1002

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 143)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity14.37
▷ Minimum class complexity1.00
▷ Maximum class complexity159.00
Average method complexity3.53
▷ Minimum method complexity1.00
▷ Maximum method complexity143.00
Code structure
Namespaces18
Interfaces2
Traits0
Classes73
▷ Abstract classes45.48%
▷ Concrete classes6994.52%
▷ Final classes00.00%
Methods403
▷ Static methods6516.13%
▷ Public methods28570.72%
▷ Protected methods317.69%
▷ Private methods8721.59%
Functions35
▷ Named functions2468.57%
▷ Anonymous functions1131.43%
Constants51
▷ Global constants1427.45%
▷ Class constants3772.55%
▷ Public constants2156.76%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
PNG images were not found in this plugin