77% aco-product-labels-for-woocommerce

Code Review | Product Labels For Woocommerce (Sale Badges)

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

About plugin

  • Plugin page: aco-product-label...
  • Plugin version: 1.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.3
  • WordPress version: 6.3.1
  • First release: Jul 9, 2020
  • Latest release: Aug 30, 2023
  • Number of updates: 58
  • Update frequency: every 19.8 days
  • Top authors: acowebscd (79.31%)acowebs (22.41%)

Code review

54 tests

User reviews

34 reviews

Install metrics

8,000+ active /129,580 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.53MB] [CPU: ▼5.55ms] Passed 4 tests

This is a short check of server-side resources used by Product Labels For Woocommerce (Sale Badges)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.94 ▲0.4843.09 ▼9.04
Dashboard /wp-admin3.89 ▲0.5953.10 ▼0.38
Posts /wp-admin/edit.php3.94 ▲0.5854.81 ▼0.03
Add New Post /wp-admin/post-new.php6.44 ▲0.55100.33 ▼12.74
Media Library /wp-admin/upload.php3.75 ▲0.5244.97 ▲9.01

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 45 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
acoplw_version
db_upgraded
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Product Labels For Woocommerce (Sale Badges)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5713.38 ▼0.931.91 ▲0.1443.23 ▲0.03
Dashboard /wp-admin2,224 ▲215.86 ▼0.04100.19 ▼16.2439.33 ▼9.45
Posts /wp-admin/edit.php2,103 ▲62.01 ▲0.0141.01 ▲2.1835.13 ▼0.63
Add New Post /wp-admin/post-new.php1,548 ▲223.19 ▼0.12674.49 ▲20.2057.70 ▲5.03
Media Library /wp-admin/upload.php1,403 ▼04.27 ▲0.03106.26 ▲1.2247.40 ▲2.68

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
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • acoplw_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
Please fix the following items
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/aco-product-labels-for-woocommerce/includes/views/admin-lists.php
    • > /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
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > 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-root.php on line 1
    • > 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-settings.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Donate link: Invalid url: ""
Please take inspiration from this readme.txt

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

The principal PHP file in "Product Labels For Woocommerce (Sale Badges)" v. 1.5.2 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("aco-product-labels-for-woocommerce.php" instead of "start.php")
  • Requires at least: Required version does not match the one declared in readme.txt ("4.9" instead of "4.4")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin3,457 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP96235312,199
CSS22112421
JSON200358
PO File1141141296
JavaScript31541154
XML10021
SVG1008

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please tend to the following items
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 172)
Cyclomatic complexity
Average complexity per logical line of code0.75
Average class complexity136.60
▷ Minimum class complexity4.00
▷ Maximum class complexity413.00
Average method complexity9.53
▷ Minimum method complexity1.00
▷ Maximum method complexity172.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods78
▷ Static methods56.41%
▷ Public methods7798.72%
▷ Protected methods00.00%
▷ Private methods11.28%
Functions8
▷ Named functions337.50%
▷ Anonymous functions562.50%
Constants14
▷ 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.07MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/cssbadges/bsfifteen.png1.79KB0.50KB▼ 72.10%
assets/images/cssbadges/bseight.png3.49KB1.47KB▼ 57.83%
assets/images/ad_bg.png17.05KB19.03KB0.00%
assets/images/cssbadges/bsone.png1.25KB0.66KB▼ 46.75%
assets/images/delete.png0.65KB0.74KB0.00%