84% woocommerce-new-product-badge

Code Review | WooCommerce New Product Badge

WordPress plugin WooCommerce New Product Badge scored84%from 54 tests.

About plugin

  • Plugin page: woocommerce-new-p...
  • Plugin version: 0.3.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.0
  • WordPress version: 6.3.1
  • First release: May 6, 2013
  • Latest release: Sep 4, 2014
  • Number of updates: 7
  • Update frequency: every 69.4 days
  • Top authors: jameskoster (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

1,000+ active /81,935 total downloads

Benchmarks

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
Installer ran successfully

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

Analyzing server-side resources used by WooCommerce New Product Badge
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.34 ▼3.27
Dashboard /wp-admin3.31 ▲0.0051.70 ▼2.61
Posts /wp-admin/edit.php3.36 ▲0.0043.52 ▼7.08
Add New Post /wp-admin/post-new.php5.89 ▲0.0082.74 ▼15.50
Media Library /wp-admin/upload.php3.23 ▲0.0035.66 ▼1.30

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 8 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce New Product Badge
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.33 ▼1.034.91 ▲2.9845.33 ▲1.99
Dashboard /wp-admin2,209 ▲214.80 ▼0.14111.09 ▼6.1242.68 ▼3.04
Posts /wp-admin/edit.php2,094 ▲52.01 ▲0.0238.46 ▲2.3230.29 ▼5.15
Add New Post /wp-admin/post-new.php1,534 ▲2023.22 ▲5.59633.95 ▼58.9661.40 ▼0.20
Media Library /wp-admin/upload.php1,391 ▲34.21 ▲0.0198.80 ▲1.4641.90 ▼2.82

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% 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)
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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 fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/woocommerce-new-product-badge/new-badge.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: new product, woocommerce, ecommerce, new

woocommerce-new-product-badge/new-badge.php 85% from 13 tests

This is the main PHP file of "WooCommerce New Product Badge" version 0.3.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("woocommerce-new-product-badge.php" instead of "new-badge.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

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
Everything looks great! No dangerous files found in this plugin147 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PO File2225281
PHP1253453
CSS10010
Markdown1103

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity3.00
▷ Minimum class complexity3.00
▷ Maximum class complexity3.00
Average method complexity1.40
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected