89% woocommerce-product-badge

Code Review | WooCommerce Product Badge

WordPress plugin WooCommerce Product Badge scored89%from 54 tests.

About plugin

  • Plugin page: woocommerce-produ...
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8.1-4.1.1
  • WordPress version: 6.3.1
  • First release: Aug 8, 2014
  • Latest release: Apr 20, 2015
  • Number of updates: 9
  • Update frequency: every 28.4 days
  • Top authors: terrytsang (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

300+ active /11,979 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.00MB] [CPU: ▼10.78ms] Passed 4 tests

An overview of server-side resources used by WooCommerce Product Badge
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0044.65 ▲7.36
Dashboard /wp-admin3.31 ▲0.0046.84 ▼22.61
Posts /wp-admin/edit.php3.36 ▲0.0046.88 ▼12.37
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.54 ▼10.10
Media Library /wp-admin/upload.php3.23 ▲0.0036.15 ▲1.97

Server storage [IO: ▲1.11MB] [DB: ▲0.07MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 15 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce Product Badge
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.18 ▼0.481.77 ▲0.1444.97 ▼4.31
Dashboard /wp-admin2,192 ▲155.55 ▼0.0289.79 ▼5.6039.60 ▼3.09
Posts /wp-admin/edit.php2,100 ▼31.96 ▼0.0435.39 ▼6.2437.82 ▲2.68
Add New Post /wp-admin/post-new.php1,526 ▼423.56 ▲0.51682.20 ▲23.6666.00 ▲10.08
Media Library /wp-admin/upload.php1,400 ▼34.19 ▼0.2193.47 ▼4.1942.83 ▼3.26

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 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
Looking good! No server-side errors or output on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Please add images for these screenshots: #1 (The WooCommerce > Product Badge option page.), #2 (The shop page with product badges.), #3 (The product page with Sale and New badge.), #4 (The mobile layout for product page.), #5 (The product badge/label shown "After Product Price" as Display Position option.)
The official readme.txt might help

woocommerce-product-badge/wc-product-badge.php 92% from 13 tests

Analyzing the main PHP file in "WooCommerce Product Badge" version 1.0.4
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("woocommerce-product-badge.php" instead of "wc-product-badge.php")

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
No dangerous file extensions were detected551 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP18461279
PO File258112156
CSS2160113
Markdown1103

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity32.00
▷ Minimum class complexity32.00
▷ Maximum class complexity32.00
Average method complexity4.10
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 1.08MB with 0.70MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-4.png32.39KB12.22KB▼ 62.26%
screenshot-1.png64.37KB22.08KB▼ 65.70%
screenshot-3.png465.10KB160.33KB▼ 65.53%
screenshot-2.png141.01KB50.78KB▼ 63.99%
screenshot-5.png397.98KB136.18KB▼ 65.78%