83% cognito-forms

Code Review | Cognito Forms

WordPress plugin Cognito Forms scored83%from 54 tests.

About plugin

  • Plugin page: cognito-forms
  • Plugin version: 2.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-6.4
  • WordPress version: 6.3.1
  • First release: May 16, 2014
  • Latest release: Nov 9, 2023
  • Number of updates: 45
  • Update frequency: every 77.0 days
  • Top authors: cognitoapps (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

2,000+ active /76,174 total downloads

Benchmarks

Plugin footprint 83% 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.05MB] [CPU: ▼3.34ms] Passed 4 tests

A check of server-side resources used by Cognito Forms
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0535.06 ▼4.09
Dashboard /wp-admin3.35 ▲0.0545.52 ▼0.59
Posts /wp-admin/edit.php3.46 ▲0.1147.03 ▲0.60
Add New Post /wp-admin/post-new.php5.93 ▲0.0488.30 ▼9.26
Media Library /wp-admin/upload.php3.27 ▲0.0435.27 ▲3.38

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 21 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
cognito_public_key
db_upgraded
theysaidso_admin_options
cognito_dev_environment
widget_recent-comments
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Cognito Forms
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,792 ▲3014.72 ▲0.351.48 ▼0.2139.78 ▲2.70
Dashboard /wp-admin2,198 ▲235.62 ▼0.1299.50 ▼10.4741.54 ▼2.93
Posts /wp-admin/edit.php2,103 ▲32.00 ▼0.0138.91 ▲0.4035.22 ▲1.80
Add New Post /wp-admin/post-new.php6,201 ▲4,67119.14 ▼3.87903.70 ▲258.4160.61 ▲7.77
Media Library /wp-admin/upload.php1,403 ▲64.27 ▲0.1598.24 ▼7.4543.17 ▼2.39

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 8 options
    • theysaidso_admin_options
    • cognito_dev_environment
    • can_compress_scripts
    • cognito_public_key
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/cognito-forms/api.php:25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/cognito-forms/api.php:25

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 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
Attributes that require attention:
  • Tags: Too many tags (24 tag instead of maximum 10); only the first 5 tags are used in your directory listing
  • Screenshots: These screenshots do not have images: #1 (With Cognito Forms's easy-to-use form builder, create responsive contact forms, order forms, registration forms and more in minutes.), #2 (Add a block to the post or page where you'd like to embed your form.), #3 (Select the Cognito Forms block.), #4 (Choose "Select Form".), #5 (Select the form you would like to embed.), #6 (Your form is now embedded on the post/page.), #7 (Preview or publish to see your form in action!)
The official readme.txt is a good inspiration

cognito-forms/cognito-forms.php 92% from 13 tests

"Cognito Forms" version 2.0.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 148 characters long)

Code Analysis Passed 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
Success! There were no dangerous files found in this plugin237 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP44792199
JavaScript23130
SVG1107
CSS2211

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity9.50
▷ Minimum class complexity4.00
▷ Maximum class complexity15.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods17
▷ Static methods317.65%
▷ Public methods1270.59%
▷ Protected methods00.00%
▷ Private methods529.41%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
8 PNG files occupy 0.65MB with 0.30MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-7.png151.07KB60.34KB▼ 60.05%
screenshot-5.png78.21KB29.95KB▼ 61.71%
screenshot-4.png27.41KB21.39KB▼ 21.94%
screenshot-2.png33.59KB26.28KB▼ 21.77%
screenshot-1.png111.93KB35.92KB▼ 67.91%