72% product-badges-for-woocommerce

Code Review | Product Badges For Woocommerce

WordPress plugin Product Badges For Woocommerce scored72%from 54 tests.

About plugin

  • Plugin page: product-badges-fo...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.3.1
  • WordPress version: 6.3.1
  • First release: Jun 11, 2022
  • Latest release: Oct 2, 2023
  • Number of updates: 9
  • Update frequency: every 53.2 days
  • Top authors: silverplugins217 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /720 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.01MB] [CPU: ▼9.19ms] Passed 4 tests

Analyzing server-side resources used by Product Badges For Woocommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0039.09 ▼0.44
Dashboard /wp-admin3.31 ▼0.0446.79 ▼13.21
Posts /wp-admin/edit.php3.36 ▲0.0041.89 ▼5.50
Add New Post /wp-admin/post-new.php5.89 ▲0.0079.35 ▼17.59
Media Library /wp-admin/upload.php3.23 ▲0.0032.73 ▼0.40
Add New /wp-admin/post-new.php?post_type=pbfw_product_badges3.0424.08
All Product Badges /wp-admin/edit.php?post_type=pbfw_product_badges3.0424.59

Server storage [IO: ▲0.22MB] [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: 15 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Product Badges For Woocommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,845 ▲5914.39 ▲0.011.81 ▼0.1744.11 ▲5.39
Dashboard /wp-admin2,189 ▲125.66 ▲0.0297.46 ▲10.1044.31 ▲1.12
Posts /wp-admin/edit.php2,100 ▼02.00 ▼0.0133.93 ▼3.7335.40 ▼3.35
Add New Post /wp-admin/post-new.php1,536 ▲1018.06 ▼5.22606.91 ▼49.3763.51 ▲9.33
Media Library /wp-admin/upload.php1,400 ▼04.21 ▼0.0294.46 ▼8.9942.00 ▼6.56
Add New /wp-admin/post-new.php?post_type=pbfw_product_badges280.420.073.75
All Product Badges /wp-admin/edit.php?post_type=pbfw_product_badges280.420.094.04

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/product-badges-for-woocommerce/product-badges-for-woocommerce.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-badges-for-woocommerce/main/resources/pbfw-load-js-css.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-badges-for-woocommerce/main/resources/pbfw-language.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-badges-for-woocommerce/main/resources/pbfw-installation-require.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/post-new.php?post_type=pbfw_product_badges
    • > Network (severe)
    wp-admin/post-new.php?post_type=pbfw_product_badges - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit.php?post_type=pbfw_product_badges
    • > Network (severe)
    wp-admin/edit.php?post_type=pbfw_product_badges - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Contributors: Contributors not specified
The official readme.txt is a good inspiration

product-badges-for-woocommerce/product-badges-for-woocommerce.php 92% from 13 tests

The entry point to "Product Badges For Woocommerce" version 1.0 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin2,258 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP692301,074
CSS25144672
JavaScript275148512

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions21
▷ Named functions21100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
4 PNG files occupy 0.11MB with 0.06MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/badge2.png33.90KB12.97KB▼ 61.75%
assets/img/badge1.png16.75KB9.76KB▼ 41.76%
assets/img/badge.png23.76KB9.51KB▼ 59.98%
assets/img/badge3.png37.72KB15.55KB▼ 58.77%