77% cost-of-goods

Code Review | Cost Of Goods

WordPress plugin Cost Of Goods scored77%from 54 tests.

About plugin

  • Plugin page: cost-of-goods
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.1
  • WordPress version: 6.3.1
  • First release: Dec 20, 2022
  • Latest release: Jan 4, 2023
  • Number of updates: 3
  • Update frequency: every 7.0 days
  • Top authors: wpiron (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /243 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

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

This is a short check of server-side resources used by Cost Of Goods
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0046.49 ▲5.25
Dashboard /wp-admin3.31 ▲0.0043.85 ▼8.45
Posts /wp-admin/edit.php3.36 ▲0.0048.53 ▼0.57
Add New Post /wp-admin/post-new.php5.89 ▲0.00137.18 ▲32.45
Media Library /wp-admin/upload.php3.23 ▲0.0036.95 ▲4.67

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 30 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Cost Of Goods
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4313.22 ▼1.161.85 ▼0.5143.14 ▼6.04
Dashboard /wp-admin2,206 ▲185.91 ▲0.10108.84 ▲5.5140.53 ▼1.66
Posts /wp-admin/edit.php2,089 ▼02.05 ▲0.0644.29 ▲4.5540.13 ▲1.08
Add New Post /wp-admin/post-new.php1,534 ▼823.05 ▲4.63700.46 ▲80.4360.93 ▲3.39
Media Library /wp-admin/upload.php1,388 ▲64.10 ▼0.0899.26 ▼4.4940.73 ▼2.84

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
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cost-of-goods/public/partials/cost-of-goods-for-woocommerce-public-display.php
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/cost-of-goods/includes/class-cost-of-goods-for-woocommerce.php:32

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (cod-screenshot-1.png), #2 (cod-screenshot-2.png), #3 (reports.png)
The official readme.txt is a good inspiration

cost-of-goods/cost-of-goods-for-woocommerce.php 85% from 13 tests

The main PHP file in "Cost Of Goods" ver. 1.1.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("cost-of-goods.php" instead of "cost-of-goods-for-woocommerce.php")
  • Requires at least: The required version number must match the one declared in readme.txt ("4.7" instead of "3.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected10,474 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
JSON2009,816
PHP13138495596
JavaScript2152962
CSS2080

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity3.14
▷ Minimum class complexity1.00
▷ Maximum class complexity13.00
Average method complexity1.44
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods34
▷ Static methods38.82%
▷ Public methods2985.29%
▷ Protected methods00.00%
▷ Private methods514.71%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 2.55MB with 1.78MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/partials/img/b.png118.21KB49.99KB▼ 57.71%
admin/partials/img/dashboard.png260.49KB65.23KB▼ 74.96%
admin/partials/img/cog-variations.png2,163.44KB433.48KB▼ 79.96%
admin/partials/img/a.png73.54KB24.48KB▼ 66.71%