10% cf7-cpfcnpj-validations

Code Review | Contact Form 7 CPF/CNPJ Validations

WordPress plugin Contact Form 7 CPF/CNPJ Validations scored10%from 54 tests.

About plugin

  • Plugin page: cf7-cpfcnpj-valid...
  • Plugin version: 0.0.4
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.9.7
  • WordPress version: 6.3.1
  • First release: Jan 30, 2018
  • Latest release: Jul 10, 2018
  • Number of updates: 8
  • Update frequency: every 20.1 days
  • Top authors: vsilva472 (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

800+ active /6,939 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The following installer errors require your attention
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/cf7-cpfcnpj-validations/classes/Cpf.php+91
    Array and string offset access syntax with curly braces is deprecated

Server metrics [RAM: ▼1.92MB] [CPU: ▼56.80ms] Passed 4 tests

An overview of server-side resources used by Contact Form 7 CPF/CNPJ Validations
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.07 ▼1.394.89 ▼38.95
Dashboard /wp-admin2.09 ▼1.217.03 ▼47.77
Posts /wp-admin/edit.php2.09 ▼1.275.93 ▼45.53
Add New Post /wp-admin/post-new.php2.09 ▼3.805.94 ▼94.93
Media Library /wp-admin/upload.php2.09 ▼1.145.86 ▼29.71

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 7 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Contact Form 7 CPF/CNPJ Validations
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.35 ▲0.151.81 ▼0.4548.13 ▲4.89
Dashboard /wp-admin2,189 ▲155.67 ▲0.0987.52 ▼0.1642.89 ▲2.07
Posts /wp-admin/edit.php2,100 ▼02.16 ▲0.1140.38 ▼1.6937.15 ▲0.61
Add New Post /wp-admin/post-new.php1,526 ▼521.50 ▼1.83710.80 ▲11.8946.80 ▼10.27
Media Library /wp-admin/upload.php1,397 ▼64.26 ▲0.03117.79 ▲14.4351.76 ▲5.33

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/cf7-cpfcnpj-validations/classes/Cpf.php+91
    Array and string offset access syntax with curly braces is deprecated
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

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
Please take a closer look at the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractValidator' not found in wp-content/plugins/cf7-cpfcnpj-validations/classes/Cpf.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/cf7-cpfcnpj-validations/contact-form-7-cpf-cnpj-validations.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractValidator' not found in wp-content/plugins/cf7-cpfcnpj-validations/classes/Cnpj.php:4

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 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
6 plugin tags: contact, contact form, cpf, form, cpf-cnpj...

cf7-cpfcnpj-validations/contact-form-7-cpf-cnpj-validations.php 92% from 13 tests

"Contact Form 7 CPF/CNPJ Validations" version 0.0.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("cf7-cpfcnpj-validations.php" instead of "contact-form-7-cpf-cnpj-validations.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected241 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP680219241

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity8.00
▷ Minimum class complexity1.00
▷ Maximum class complexity17.00
Average method complexity2.46
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes4
▷ Abstract classes125.00%
▷ Concrete classes375.00%
▷ Final classes00.00%
Methods27
▷ Static methods13.70%
▷ Public methods1762.96%
▷ Protected methods00.00%
▷ Private methods1037.04%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants222.22%
▷ Class constants777.78%
▷ Public constants7100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin