83% code-for-cj-affiliate-network

Code Review | Tracking Code for cj.com (on WooCommerce checkout)

WordPress plugin Tracking Code for cj.com (on WooCommerce checkout) scored83%from 54 tests.

About plugin

  • Plugin page: code-for-cj-affil...
  • Plugin version: 3.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.9-6.2
  • WordPress version: 6.3.1
  • First release: Apr 12, 2018
  • Latest release: Jun 23, 2023
  • Number of updates: 66
  • Update frequency: every 28.8 days
  • Top authors: russelljamison (51.52%)hostingutilities (50%)

Code review

54 tests

User reviews

3 reviews

Install metrics

50+ active /3,337 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.21MB] [CPU: ▼16.84ms] Passed 4 tests

A check of server-side resources used by Tracking Code for cj.com (on WooCommerce checkout)
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.09 ▼1.386.23 ▼35.10
Dashboard /wp-admin3.50 ▲0.1657.00 ▼12.12
Posts /wp-admin/edit.php3.62 ▲0.2651.02 ▼0.07
Add New Post /wp-admin/post-new.php6.08 ▲0.2086.88 ▼20.08
Media Library /wp-admin/upload.php3.42 ▲0.2037.54 ▲0.71
CJ Tracking Code /wp-admin/options-general.php?page=cj-tracking-settings3.3938.01

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 38 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Tracking Code for cj.com (on WooCommerce checkout)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,861 ▲11513.20 ▼1.401.76 ▼0.0845.48 ▼0.61
Dashboard /wp-admin2,254 ▲515.85 ▲0.03114.05 ▲6.3944.72 ▼1.07
Posts /wp-admin/edit.php2,131 ▲312.13 ▼0.0234.98 ▼1.6436.26 ▲0.06
Add New Post /wp-admin/post-new.php1,577 ▲4522.46 ▼0.75671.50 ▼4.8849.48 ▼1.66
Media Library /wp-admin/upload.php1,433 ▲304.24 ▼0.05104.83 ▲4.1149.11 ▲4.61
CJ Tracking Code /wp-admin/options-general.php?page=cj-tracking-settings1,0962.0330.6937.73

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% 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)
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
The following issues need your attention
  • 21× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'CJTagInterface' not found in wp-content/plugins/code-for-cj-affiliate-network/inc/tag_defaults.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-for-cj-affiliate-network/inc/ajax/ajax_get_conversion_tag_data.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/code-for-cj-affiliate-network/inc/proxy.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-for-cj-affiliate-network/inc/ajax/ajax_get_site_tag_data.php:23
    • > PHP Warning
      Use of undefined constant CJ_TRACKING_RUN_UNIT_TESTS - assumed 'CJ_TRACKING_RUN_UNIT_TESTS' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-for-cj-affiliate-network/woocommerce/unit_tests.php on line 328
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-for-cj-affiliate-network/inc/ajax/ajax_uninstall.php:33
    • > PHP Fatal error
      Uncaught Error: Interface 'CJTagInterface' not found in wp-content/plugins/code-for-cj-affiliate-network/inc/tag_defaults.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function home_url() in wp-content/plugins/code-for-cj-affiliate-network/inc/in_prod.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-for-cj-affiliate-network/woocommerce/legacy_save_affiliate_referral_info.php:49
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-for-cj-affiliate-network/inc/ajax/ajax_proxy.php:8

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 Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: commision junction, affiliate marketing, cj, advertising, affiliate

code-for-cj-affiliate-network/cj-tracking.php 77% from 13 tests

The main PHP file in "Tracking Code for cj.com (on WooCommerce checkout)" ver. 3.3 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Git Repository: An alternative Git repository was detected
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: Name the main plugin file the same as the plugin slug ("code-for-cj-affiliate-network.php" instead of "cj-tracking.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin3,471 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
PHP266154523,076
Markdown2960304
JavaScript4244089
CSS2002

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity15.53
▷ Minimum class complexity1.00
▷ Maximum class complexity107.00
Average method complexity2.79
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods118
▷ Static methods21.69%
▷ Public methods10891.53%
▷ Protected methods00.00%
▷ Private methods108.47%
Functions88
▷ Named functions6270.45%
▷ Anonymous functions2629.55%
Constants12
▷ Global constants866.67%
▷ Class constants433.33%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin