78% wc-cart-pdf

Code Review | WooCommerce Cart PDF

WordPress plugin WooCommerce Cart PDF scored 78% from 54 tests.

About plugin

  • Plugin page: wc-cart-pdf
  • Plugin version: 2.2.0
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.8.1
  • WordPress version: 5.9.2
  • First release: Feb 20, 2019
  • Latest release: Oct 25, 2021
  • Number of updates: 26
  • Update frequency: every 37.6 days
  • Top authors: dkjensen (96.15%)seattlewebco (7.69%)

Code review

54 tests

User reviews

16 reviews

Install metrics

1,000+ active / 7,366 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.01MB] [CPU: ▼330.46ms] Passed 4 tests

This is a short check of server-side resources used by WooCommerce Cart PDF
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0267.22 ▲10.41
Dashboard /wp-admin3.43 ▲0.0249.61 ▲10.67
Posts /wp-admin/edit.php3.65 ▲0.0139.20 ▼2.68
Add New Post /wp-admin/post-new.php6.89 ▼0.0895.72 ▼1,332.15
Media Library /wp-admin/upload.php3.30 ▲0.0128.00 ▲2.60
Customize /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php4.6284.80

Server storage [IO: ▲92.11MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
These are issues you should consider
  • Total filesystem usage must be limited to 25MB (currently using 92.11MB)
Filesystem: 623 new files
Database: no new tables, 2 new options
New WordPress options
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for WooCommerce Cart PDF
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,780 ▲5815.94 ▼0.066.25 ▲0.752.22 ▼0.04
Dashboard /wp-admin2,897 ▲366.15 ▼0.11114.95 ▼23.38155.76 ▼6.90
Posts /wp-admin/edit.php2,689 ▼13.24 ▲0.00116.08 ▲51.51153.38 ▲9.91
Add New Post /wp-admin/post-new.php1,701 ▼1021.72 ▲0.32459.95 ▲20.75187.50 ▼14.97
Media Library /wp-admin/upload.php1,700 ▲25.50 ▼0.05135.00 ▼0.32187.12 ▼53.85
Customize /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php7,19919.61514.74176.42

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 2 options in the database
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/customize.php?return=%2Fwp-admin%2Fwp-api.php
    • > Notice in wp-includes/class-wp-customize-nav-menus.php+1152
    Trying to get property 'title' of non-object

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
  • 213× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/Time.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/Sub.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Filter\\FilterException' not found in wp-content/plugins/wc-cart-pdf/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\Filter\\Filter' not found in wp-content/plugins/wc-cart-pdf/vendor/myclabs/deep-copy/src/DeepCopy/Filter/KeepFilter.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\Tag' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/SetHtmlPageFooter.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/B.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\SetHtmlPageFooter' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/SetPageHeader.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\Tcpdf\\Fpdi' not found in wp-content/plugins/wc-cart-pdf/vendor/setasign/fpdi/src/TcpdfFpdi.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\MpdfException' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Exception/FontException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/Kbd.php:5

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
No plugin tags provided

wc-cart-pdf/wc-cart-pdf.php Passed 13 tests

The principal PHP file in "WooCommerce Cart PDF" v. 2.2.0 is loaded by WordPress automatically on each request
48 characters long description:
Allows customers to download their cart as a PDF

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin77,086 lines of code in 403 files:
LanguageFilesBlank linesComment linesLines of code
PHP38911,06511,64576,125
CSS26518405
JSON100326
YAML5524154
XML27055
Markdown210017
Bourne Shell1203
JavaScript1011

PHP code 0% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 7,009)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity60.47
▷ Minimum class complexity1.00
▷ Maximum class complexity7,009.00
Average method complexity14.17
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces44
Interfaces10
Traits6
Classes279
▷ Abstract classes93.23%
▷ Concrete classes27096.77%
▷ Final classes134.81%
Methods1,340
▷ Static methods13810.30%
▷ Public methods1,15786.34%
▷ Protected methods554.10%
▷ Private methods1289.55%
Functions47
▷ Named functions2348.94%
▷ Anonymous functions2451.06%
Constants430
▷ Global constants81.86%
▷ Class constants42298.14%
▷ Public constants422100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin