78% aco-product-labels-for-woocommerce

Code Review | Product Labels For Woocommerce (Sale Badges)

WordPress plugin Product Labels For Woocommerce (Sale Badges) scored 78% from 54 tests.

About plugin

  • Plugin page: aco-product-label...
  • Plugin version: 1.2.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.9
  • WordPress version: 5.9.2
  • First release: Jul 9, 2020
  • Latest release: Mar 29, 2022
  • Number of updates: 34
  • Update frequency: every 18.5 days
  • Top authors: acowebscd (64.71%)acowebs (38.24%)

Code review

54 tests

User reviews

8 reviews

Install metrics

5,000+ active / 44,658 total downloads


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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.42MB] [CPU: ▼299.36ms] Passed 4 tests

A check of server-side resources used by Product Labels For Woocommerce (Sale Badges)
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.94 ▲0.4369.40 ▲6.72
Dashboard /wp-admin3.83 ▲0.4238.40 ▲2.41
Posts /wp-admin/edit.php4.05 ▲0.4143.83 ▼9.68
Add New Post /wp-admin/post-new.php7.38 ▲0.41111.21 ▼1,190.94
Media Library /wp-admin/upload.php3.77 ▲0.4733.05 ▲0.76

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 42 new files
Database: no new tables, 1 new option
New WordPress options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Product Labels For Woocommerce (Sale Badges)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,821 ▲6715.72 ▲0.307.66 ▼0.753.46 ▲0.05
Dashboard /wp-admin2,914 ▲376.48 ▼0.02158.49 ▼13.18176.96 ▼12.16
Posts /wp-admin/edit.php2,691 ▼03.43 ▼0.0170.46 ▼17.57163.20 ▼11.03
Add New Post /wp-admin/post-new.php1,658 ▲2320.65 ▲3.56562.16 ▼3.11198.53 ▲21.76
Media Library /wp-admin/upload.php1,695 ▼25.72 ▲0.01168.81 ▼2.72225.70 ▼9.77

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • acoplw_version

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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-root.php
    • > /wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-settings.php
    • > /wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-lists.php
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/aco-product-labels-for-woocommerce/start.php:24
    • > PHP Warning
      Use of undefined constant ACOPLW_TOKEN - assumed 'ACOPLW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-root.php on line 1
    • > PHP Warning
      Use of undefined constant ACOPLW_TOKEN - assumed 'ACOPLW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-lists.php on line 1
    • > PHP Warning
      Use of undefined constant ACOPLW_TOKEN - assumed 'ACOPLW_TOKEN' (this will throw an Error in a future version of PHP) in wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-settings.php on line 1

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)
No browser errors were detected


Plugin configuration 90% from 29 tests

readme.txt 94% from 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
Attributes that require attention:
  • Donate link: Please fix this invalid url: ""
You can take inspiration from this readme.txt

aco-product-labels-for-woocommerce/start.php 85% from 13 tests

The main PHP script in "Product Labels For Woocommerce (Sale Badges)" version 1.2.5 is automatically included on every request by WordPress
It is important to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("4.9" instead of "4.4")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("aco-product-labels-for-woocommerce.php" instead of "start.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected2,879 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PO File1138138290

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity90.60
▷ Minimum class complexity4.00
▷ Maximum class complexity255.00
Average method complexity6.81
▷ Minimum method complexity1.00
▷ Maximum method complexity98.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
▷ Static methods56.67%
▷ Public methods7498.67%
▷ Protected methods00.00%
▷ Private methods11.33%
▷ Named functions350.00%
▷ Anonymous functions350.00%
▷ Global constants14100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
21 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/acoplw-icons.png10.34KB3.87KB▼ 62.54%
assets/images/cssbadges/bsnine.png1.32KB0.70KB▼ 46.81%
assets/images/cssbadges/bsone.png1.25KB0.66KB▼ 46.75%
assets/images/acoplw-icons-old.png4.45KB1.84KB▼ 58.70%