88% gf-campaign-fields

Code Review | Gravity Forms Campaign Fields Add-On

WordPress plugin Gravity Forms Campaign Fields Add-On scored 88% from 54 tests.

About plugin

  • Plugin page: gf-campaign-fields
  • Plugin version: 2.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9.5
  • WordPress version: 5.8.1
  • First release: Apr 14, 2017
  • Latest release: May 10, 2018
  • Number of updates: 21
  • Update frequency: every 18.6 days
  • Top authors: alquemie (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

400+ active / 3,416 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼147.22ms] Passed 4 tests

Analyzing server-side resources used by Gravity Forms Campaign Fields Add-On
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.83 ▲0.0036.00 ▼0.37
Dashboard /wp-admin3.06 ▲0.0046.05 ▲6.23
Posts /wp-admin/edit.php3.11 ▼0.0142.35 ▼10.76
Add New Post /wp-admin/post-new.php5.42 ▼0.0289.84 ▼570.27
Media Library /wp-admin/upload.php3.00 ▲0.0034.03 ▼7.48

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 435 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Gravity Forms Campaign Fields Add-On: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,703 ▲6615.90 ▲0.4011.30 ▲2.5950.58 ▲2.78
Dashboard /wp-admin2,973 ▲395.87 ▼0.09136.08 ▼12.45110.13 ▼2.61
Posts /wp-admin/edit.php2,739 ▼02.70 ▲0.0173.13 ▲7.4090.92 ▼4.22
Add New Post /wp-admin/post-new.php1,672 ▲9118.77 ▲0.37377.29 ▼28.31112.52 ▼0.51
Media Library /wp-admin/upload.php1,810 ▲35.00 ▼0.02155.31 ▼25.02117.67 ▼14.91

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
This plugin's uninstaller ran successfully

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

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 5× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/bin/update-browser-ids.php
    • > /wp-content/plugins/gf-campaign-fields/lib/whichbrowser/server/detect.php
    • > /wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/bin/update-profiles.php
    • > /wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/bin/update-chrome.php
    • > /wp-content/plugins/gf-campaign-fields/lib/whichbrowser/server/index.php
  • 87× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\BrowserIds' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/data/id-android.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/data/indices/models-bada.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\ameVersion' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/src/Model/Using.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\ameVersion' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/src/Model/Browser.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\\Base' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/src/Model/Primitive/NameVersion.php:11
    • > PHP Notice
      Undefined index: HTTPS in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/server/index.php on line 125
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/tests/unit/Model/FamilyTest.php:12
    • > PHP Warning
      file_get_contents(https://api.whichbrowser.net/resources/profiles.json): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error\r in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/bin/update-profiles.php on line 7
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/data/indices/models-asha.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/gf-campaign-fields/lib/whichbrowser/parser/data/models-touchwiz.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
3 plugin tags: marketing, google analytics, gravity forms

gf-campaign-fields/gf-campaign-fields.php Passed 13 tests

"Gravity Forms Campaign Fields Add-On" version 2.4.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
78 characters long description:
Creates new field types that are populated with Google Analytics campaign data

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin75,085 lines of code in 422 files:
LanguageFilesBlank linesComment linesLines of code
PHP1584,9251,61651,371
YAML22914021,369
Markdown851101,212
JavaScript181481754
JSON770332
XML27047

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 105)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity26.35
▷ Minimum class complexity1.00
▷ Maximum class complexity474.00
Average method complexity6.38
▷ Minimum method complexity1.00
▷ Maximum method complexity105.00
Code structure
Namespaces12
Interfaces4
Traits25
Classes63
▷ Abstract classes00.00%
▷ Concrete classes63100.00%
▷ Final classes00.00%
Methods442
▷ Static methods337.47%
▷ Public methods25758.14%
▷ Protected methods00.00%
▷ Private methods18541.86%
Functions28
▷ Named functions1450.00%
▷ Anonymous functions1450.00%
Constants76
▷ Global constants22.63%
▷ Class constants7497.37%
▷ Public constants74100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

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