88% change-woocommerce-add-to-cart-button-text

Code Review | Change WooCommerce Add To Cart Button Text

WordPress plugin Change WooCommerce Add To Cart Button Text scored 88% from 54 tests.

About plugin

  • Plugin page: change-woocommerc...
  • Plugin version: 1.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.3
  • WordPress version: 5.9.2
  • First release: Jul 29, 2015
  • Latest release: Mar 19, 2020
  • Number of updates: 20
  • Update frequency: every 84.8 days
  • Top authors: badsha_eee (55%)rextheme (50%)

Code review

54 tests

User reviews

8 reviews

Install metrics

2,000+ active / 31,739 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.02MB] [CPU: ▼296.90ms] Passed 4 tests

A check of server-side resources used by Change WooCommerce Add To Cart Button Text
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0153.63 ▲1.33
Dashboard /wp-admin3.41 ▲0.0034.26 ▲0.22
Posts /wp-admin/edit.php3.64 ▲0.0037.54 ▼2.14
Add New Post /wp-admin/post-new.php6.88 ▼0.09101.75 ▼1,187.02
Media Library /wp-admin/upload.php3.29 ▲0.0023.98 ▲1.37

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 52 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Change WooCommerce Add To Cart Button Text
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,799 ▲4516.25 ▲0.456.19 ▲0.542.74 ▼0.15
Dashboard /wp-admin2,895 ▲346.07 ▼0.08113.04 ▼23.84151.88 ▼5.96
Posts /wp-admin/edit.php2,691 ▼33.24 ▲0.0163.46 ▼0.60142.98 ▼0.37
Add New Post /wp-admin/post-new.php1,752 ▲9121.51 ▲5.73429.14 ▲8.29151.10 ▼2.45
Media Library /wp-admin/upload.php1,698 ▲35.49 ▲0.02143.19 ▲4.56180.09 ▼6.62

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/change-woocommerce-add-to-cart-button-text/admin/partials/rex-variation-swatches-for-woocommerce-admin-display.php
    • > /wp-content/plugins/change-woocommerce-add-to-cart-button-text/public/partials/rex-variation-swatches-for-woocommerce-public-display.php
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/change-woocommerce-add-to-cart-button-text/change-wc-button-text.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/change-woocommerce-add-to-cart-button-text/admin/class-rex-variation-swatches-for-woocommerce-admin-product.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/change-woocommerce-add-to-cart-button-text/admin/partials/rexvs_settings.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
4 plugin tags: change, add to cart, woocommerce, button

change-woocommerce-add-to-cart-button-text/change-wc-button-text.php 85% from 13 tests

Analyzing the main PHP file in "Change WooCommerce Add To Cart Button Text" version 1.3
Please make the necessary changes and fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 148 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("change-woocommerce-add-to-cart-button-text.php" instead of "change-wc-button-text.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected6,046 lines of code in 36 files:
LanguageFilesBlank linesComment linesLines of code
PHP229071,4653,871
CSS3187670
PO File5255280613
Sass1795585
JavaScript59082307

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 190)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity38.53
▷ Minimum class complexity1.00
▷ Maximum class complexity299.00
Average method complexity5.11
▷ Minimum method complexity1.00
▷ Maximum method complexity190.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods137
▷ Static methods64.38%
▷ Public methods9367.88%
▷ Protected methods64.38%
▷ Private methods3827.74%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icon.png1.88KB1.26KB▼ 32.88%
images/logo.png4.46KB2.49KB▼ 44.20%