76% woocommerce-pdf-invoices

Code Review | Invoices for WooCommerce

WordPress plugin Invoices for WooCommerce scored76%from 54 tests.

About plugin

  • Plugin page: woocommerce-pdf-i...
  • Plugin version: 3.1.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.8
  • WordPress version: 6.3.1
  • First release: Dec 7, 2013
  • Latest release: Oct 12, 2021
  • Number of updates: 310
  • Update frequency: every 9.3 days
  • Top authors: baaaaas (100%)

Code review

54 tests

User reviews

468 reviews

Install metrics

20,000+ active /652,075 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

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

Server-side resources used by Invoices for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.26 ▼0.12
Dashboard /wp-admin3.32 ▼0.0343.23 ▼15.43
Posts /wp-admin/edit.php3.37 ▲0.0146.64 ▲2.20
Add New Post /wp-admin/post-new.php5.90 ▲0.0193.14 ▲4.23
Media Library /wp-admin/upload.php3.24 ▲0.0135.83 ▼0.60

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

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • Total filesystem usage should be limited to 25MB (currently using 30.60MB)
Filesystem: 389 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Invoices for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.28 ▼1.101.55 ▼0.2640.75 ▼5.48
Dashboard /wp-admin2,203 ▲124.81 ▼1.09109.71 ▼6.7242.08 ▼19.73
Posts /wp-admin/edit.php2,089 ▼32.00 ▼0.0639.04 ▲4.0935.91 ▲2.23
Add New Post /wp-admin/post-new.php1,533 ▲1223.35 ▲0.16597.69 ▼9.2349.39 ▼2.76
Media Library /wp-admin/upload.php1,379 ▼124.20 ▼0.0299.31 ▼1.1342.88 ▼1.28

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 8× PHP files output text when accessed directly:
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/compress.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/includes/admin/views/html-order-page-pdf-invoice-meta-box.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/font_dump.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/index.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/image_details.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/font_coverage.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/font_names.php
    • > /wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/utils/font_collections.php
  • 66× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      include_once(_JPGRAPH_PATHjpgraph_scatter.php): failed to open stream: No such file or directory in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/graph.php on line 26
    • > PHP Warning
      include_once(_JPGRAPH_PATHjpgraph_bar.php): failed to open stream: No such file or directory in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/graph.php on line 30
    • > PHP Notice
      Undefined index: filename in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/includes/out.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_url() in wp-content/plugins/woocommerce-pdf-invoices/includes/admin/views/html-deactivation-notice.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Autoload\\AutoloadGenerator' not found in wp-content/plugins/woocommerce-pdf-invoices/vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php:30
    • > PHP Notice
      Undefined index: opname in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/includes/out.php on line 11
    • > PHP Warning
      Use of undefined constant _JPGRAPH_PATH - assumed '_JPGRAPH_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/graph.php on line 25
    • > PHP Warning
      include_once(): Failed opening '_JPGRAPH_PATHjpgraph_scatter.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/graph.php on line 26
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/config_fonts-distr-without-OTL.php:16
    • > PHP Warning
      include_once(_JPGRAPH_PATHjpgraph_pie3d.php): failed to open stream: No such file or directory in wp-content/plugins/woocommerce-pdf-invoices/vendor/mpdf/mpdf/graph.php on line 29

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 79% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === woocommerce-pdf-invoices === )
  • Tags: Please reduce the number of tags, currently 23 tag instead of maximum 10
  • Donate link: Invalid URI ("")
The official readme.txt might help

woocommerce-pdf-invoices/bootstrap.php 77% from 13 tests

This is the main PHP file of "Invoices for WooCommerce" version 3.1.9, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("woocommerce-pdf-invoices.php" instead of "bootstrap.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 141 characters long)
  • Requires at least: Required version must match the one declared in readme.txt ("4.0" instead of "3.0.0")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected92,172 lines of code in 206 files:
LanguageFilesBlank linesComment linesLines of code
PHP1728,36711,82776,853
PO File155,8859,99713,839
CSS712033956
JSON4120223
JavaScript3398144
Markdown3510125
XML13016
YAML14016

PHP code 0% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 8,309)
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 1,542)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity257.59
▷ Minimum class complexity1.00
▷ Maximum class complexity8,309.00
Average method complexity15.76
▷ Minimum method complexity1.00
▷ Maximum method complexity1,542.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes70
▷ Abstract classes57.14%
▷ Concrete classes6592.86%
▷ Final classes11.54%
Methods1,219
▷ Static methods18815.42%
▷ Public methods1,11691.55%
▷ Protected methods746.07%
▷ Private methods292.38%
Functions40
▷ Named functions3792.50%
▷ Anonymous functions37.50%
Constants390
▷ Global constants5915.13%
▷ Class constants33184.87%
▷ Public constants331100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/packing-slip-icon.png0.58KB0.46KB▼ 20.57%
assets/images/star-icon.png1.41KB1.23KB▼ 13.01%
assets/images/invoice-icon.png0.60KB0.48KB▼ 19.61%
assets/images/delete-icon.png5.52KB1.24KB▼ 77.44%