88% ab-testing-with-javascript

Code Review | AB Testing with Javascript

WordPress plugin AB Testing with Javascript scored 88% from 54 tests.

About plugin

  • Plugin page: ab-testing-with-j...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.5.1
  • WordPress version: 5.9.2
  • First release: Dec 3, 2013
  • Latest release: Feb 11, 2014
  • Number of updates: 18
  • Update frequency: every 3.9 days
  • Top authors: bmorenate (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,008 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

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

Analyzing server-side resources used by AB Testing with Javascript
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.69 ▲0.1854.57 ▼34.82
Dashboard /wp-admin3.52 ▲0.1234.38 ▼3.93
Posts /wp-admin/edit.php3.75 ▲0.1137.82 ▼1.73
Add New Post /wp-admin/post-new.php6.99 ▲0.0293.43 ▼1,145.13
Media Library /wp-admin/upload.php3.40 ▲0.1131.91 ▲5.66

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 18 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for AB Testing with Javascript
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,798 ▲7615.69 ▲0.536.51 ▲0.672.33 ▲0.09
Dashboard /wp-admin2,907 ▲576.03 ▼0.13124.37 ▼10.83178.11 ▼53.41
Posts /wp-admin/edit.php2,703 ▲93.36 ▲0.1166.84 ▲3.31202.25 ▲54.59
Add New Post /wp-admin/post-new.php1,671 ▼116.65 ▼4.79459.32 ▼20.35160.88 ▼36.75
Media Library /wp-admin/upload.php1,713 ▲155.56 ▲0.05161.31 ▼11.40191.33 ▼0.26

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstaller ran successfully

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
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/ab-testing-with-javascript/split-testing-page.php
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ab-testing-with-javascript/functions/load-resources.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ab-testing-with-javascript/functions/ajax-requests.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ab-testing-with-javascript/functions/split-testing-menu.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function site_url() in wp-content/plugins/ab-testing-with-javascript/split-testing-page.php:119
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ab-testing-with-javascript/functions/split-testing-menu.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ab-testing-with-javascript/functions/create-app-js-file.php:18

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)
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
4 plugin tags: ab tests, content experiments, ab experiments, ab testing

ab-testing-with-javascript/split-testing.php 92% from 13 tests

"AB Testing with Javascript" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("ab-testing-with-javascript.php" instead of "split-testing.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin1,641 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript2153235773
PHP6254227641
CSS2240108
Markdown1460108
HTML10011

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity24.75
▷ Minimum class complexity1.00
▷ Maximum class complexity94.00
Average method complexity3.11
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods45
▷ Static methods00.00%
▷ Public methods2044.44%
▷ Protected methods00.00%
▷ Private methods2555.56%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected