68% acf-for-woocommerce-product

Code Review | ACF for WooCommerce Product

WordPress plugin ACF for WooCommerce Product scored 68% from 54 tests.

About plugin

  • Plugin page: acf-for-woocommer...
  • Plugin version: 1.8.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.9
  • WordPress version: 5.9.2
  • First release: Nov 29, 2016
  • Latest release: Jan 28, 2022
  • Number of updates: 21
  • Update frequency: every 89.9 days
  • Top authors: pmbaldha (100%)

Code review

54 tests

User reviews

1 review

Install metrics

500+ active / 7,287 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲4.52MB] [CPU: ▼276.00ms] Passed 4 tests

This is a short check of server-side resources used by ACF for WooCommerce Product
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /8.39 ▲4.8783.64 ▲32.04
Dashboard /wp-admin8.41 ▲5.0062.05 ▲24.38
Posts /wp-admin/edit.php8.41 ▲4.7762.72 ▲22.25
Add New Post /wp-admin/post-new.php10.42 ▲3.44127.80 ▼1,173.72
Media Library /wp-admin/upload.php8.41 ▲5.1150.91 ▲23.08
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius8.4147.02
Install Plugins /wp-admin/plugins.php?page=tgmpa-install-plugins8.4161.89

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 210 new files
Database: no new tables, 4 new options
New WordPress options
fs_gdpr
fs_debug_mode
fs_active_plugins
fs_accounts

Browser metrics Passed 4 tests

This is an overview of browser requirements for ACF for WooCommerce Product
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,875 ▲12115.96 ▲0.386.10 ▲0.162.97 ▲0.01
Dashboard /wp-admin2,969 ▲1086.11 ▼0.10117.76 ▼15.03185.52 ▲21.05
Posts /wp-admin/edit.php2,792 ▲1013.25 ▲0.0166.03 ▲0.20177.09 ▲28.66
Add New Post /wp-admin/post-new.php1,710 ▼721.26 ▼0.54431.81 ▼1.33159.55 ▲1.00
Media Library /wp-admin/upload.php1,799 ▲1015.58 ▲0.04143.59 ▲2.07222.32 ▲34.83
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius1,4792.5555.92114.70
Install Plugins /wp-admin/plugins.php?page=tgmpa-install-plugins1,6582.7858.15136.71

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
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/acf-for-woocommerce-product/freemius/includes/class-freemius.php+8552
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 4 options
    • fs_active_plugins
    • fs_accounts
    • fs_debug_mode
    • fs_gdpr

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)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/acf-for-woocommerce-product/freemius/templates/ajax-loader.php
  • 11× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function did_action() in wp-content/plugins/acf-for-woocommerce-product/class-tgm-plugin-activation.php:2109
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/acf-for-woocommerce-product/afwp.php:29
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_slug() on null in wp-content/plugins/acf-for-woocommerce-product/freemius/templates/account/partials/addon.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-for-woocommerce-product/admin-functions.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: acf, advanced custom fields, field, custom, woocommerce

acf-for-woocommerce-product/afwp.php 85% from 13 tests

This is the main PHP file of "ACF for WooCommerce Product" version 1.8.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("acf-for-woocommerce-product.php" instead of "afwp.php")
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.3" instead of "3.8")

Code Analysis 97% from 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
Everything looks great! No dangerous files found in this plugin47,358 lines of code in 164 files:
LanguageFilesBlank linesComment linesLines of code
PHP1107,75417,84232,384
PO File105,5506,66712,010
Sass28399772,515
Markdown1680214
JavaScript33459194
JSON10027
CSS110014

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,908)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity84.56
▷ Minimum class complexity1.00
▷ Maximum class complexity2,908.00
Average method complexity4.62
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes52
▷ Abstract classes23.85%
▷ Concrete classes5096.15%
▷ Final classes00.00%
Methods1,233
▷ Static methods17814.44%
▷ Public methods87070.56%
▷ Protected methods383.08%
▷ Private methods32526.36%
Functions103
▷ Named functions103100.00%
▷ Anonymous functions00.00%
Constants128
▷ Global constants10078.12%
▷ Class constants2821.88%
▷ Public constants28100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%