84% woo-cart-count-shortcode

Code Review | WooCommerce Cart Count Shortcode

WordPress plugin WooCommerce Cart Count Shortcode scored84%from 54 tests.

About plugin

  • Plugin page: woo-cart-count-sh...
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.8.2
  • WordPress version: 6.3.1
  • First release: Jun 11, 2016
  • Latest release: Sep 29, 2017
  • Number of updates: 24
  • Update frequency: every 19.8 days
  • Top authors: prontotools (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

1,000+ active /19,878 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

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

This is a short check of server-side resources used by WooCommerce Cart Count Shortcode
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.79 ▲0.14
Dashboard /wp-admin3.31 ▲0.0044.37 ▼1.98
Posts /wp-admin/edit.php3.36 ▲0.0047.07 ▲1.09
Add New Post /wp-admin/post-new.php5.89 ▲0.0082.49 ▼19.37
Media Library /wp-admin/upload.php3.23 ▲0.0035.22 ▲2.98

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for WooCommerce Cart Count Shortcode
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.35 ▼1.401.75 ▼0.2442.87 ▲2.50
Dashboard /wp-admin2,206 ▲214.86 ▼0.23100.23 ▼13.1437.95 ▲0.46
Posts /wp-admin/edit.php2,089 ▼02.04 ▲0.0340.28 ▲5.9234.21 ▲3.32
Add New Post /wp-admin/post-new.php1,514 ▼717.84 ▼5.31658.09 ▼11.9458.45 ▲2.43
Media Library /wp-admin/upload.php1,388 ▼34.18 ▼0.0294.51 ▼4.6241.37 ▼2.33

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

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      require_once(): Failed opening required 'woocommerce-cart-count-shortcode.php' (include_path='.:/usr/share/php') in wp-content/plugins/woo-cart-count-shortcode/tests/test-woocommerce-cart-count-shortcode.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/woo-cart-count-shortcode/tests/bootstrap.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/woo-cart-count-shortcode/woocommerce-cart-count-shortcode.php:89
    • > PHP Warning
      require_once(woocommerce-cart-count-shortcode.php): failed to open stream: No such file or directory in wp-content/plugins/woo-cart-count-shortcode/tests/test-woocommerce-cart-count-shortcode.php on line 2
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/woo-cart-count-shortcode/tests/bootstrap.php on line 6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
9 plugin tags: count, cart count, cart, link, shopping cart...

woo-cart-count-shortcode/woocommerce-cart-count-shortcode.php 92% from 13 tests

"WooCommerce Cart Count Shortcode" version 1.0.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("woo-cart-count-shortcode.php" instead of "woocommerce-cart-count-shortcode.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
Everything looks great! No dangerous files found in this plugin657 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP36510208
Bourne Shell34114198
Dockerfile1234119
Bourne Again Shell27171
Markdown117047
XML10014

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.11
Average class complexity1.00
▷ Minimum class complexity1.00
▷ Maximum class complexity1.00
Average method complexity1.00
▷ Minimum method complexity1.00
▷ Maximum method complexity1.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods23
▷ Static methods00.00%
▷ Public methods23100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.54MB with 0.32MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-256x256.png9.50KB4.35KB▼ 54.23%
assets/banner-772x250.png21.07KB8.98KB▼ 57.39%
assets/screenshot-1.png526.92KB182.96KB▼ 65.28%