94% cf7-field-validation

Code Review | Contact form 7 Custom validation

WordPress plugin Contact form 7 Custom validation scored 94% from 54 tests.

About plugin

  • Plugin page: cf7-field-validation
  • Plugin version: 1.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3.1-4.9.1
  • WordPress version: 5.9.2
  • First release: Nov 23, 2015
  • Latest release: Apr 17, 2018
  • Number of updates: 19
  • Update frequency: every 46.2 days
  • Top authors: aiyaz (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

2,000+ active / 24,204 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.05MB] [CPU: ▼301.67ms] Passed 4 tests

A check of server-side resources used by Contact form 7 Custom validation
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.0858.74 ▲4.99
Dashboard /wp-admin3.49 ▲0.0836.50 ▲3.13
Posts /wp-admin/edit.php3.71 ▲0.0739.55 ▼1.22
Add New Post /wp-admin/post-new.php6.95 ▼0.0297.10 ▼1,207.78
Media Library /wp-admin/upload.php3.37 ▲0.0826.65 ▼0.80

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 2 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Contact form 7 Custom validation: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4716.23 ▲0.525.94 ▼0.543.28 ▲0.86
Dashboard /wp-admin2,889 ▲286.14 ▼0.06125.73 ▼11.07240.75 ▲71.14
Posts /wp-admin/edit.php2,691 ▲33.24 ▲0.0162.39 ▼1.33144.18 ▼1.90
Add New Post /wp-admin/post-new.php1,661 ▼5616.17 ▼4.93431.90 ▼39.79191.71 ▲17.48
Media Library /wp-admin/upload.php1,698 ▼35.51 ▼0.01138.17 ▼5.47221.27 ▲35.95

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
This plugin's uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cf7-field-validation/cf7-custom-validation.php:12

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
The official readme.txt is a good inspiration

cf7-field-validation/cf7-custom-validation.php 92% from 13 tests

The main PHP script in "Contact form 7 Custom validation" version 1.1.3 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("cf7-field-validation.php" instead of "cf7-custom-validation.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected186 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP14210186

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code1.13
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin