10% wc-invoice-pdf

Code Review | WC Recurring Invoice Pdf

WordPress plugin WC Recurring Invoice Pdf scored10%from 54 tests.

About plugin

  • Plugin page: wc-invoice-pdf
  • Plugin version: 1.5.18
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.5
  • WordPress version: 6.3.1
  • First release: Oct 25, 2017
  • Latest release: Feb 24, 2023
  • Number of updates: 54
  • Update frequency: every 36.1 days
  • Top authors: ole1986 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /3,917 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Please fix the following installer errors
  • The plugin cannot be installed
    • > Error in wp-content/plugins/wc-invoice-pdf/wc-invoice-pdf.php+372
    Uncaught Error: Call to a member function add_cap() on null in wp-content/plugins/wc-invoice-pdf/wc-invoice-pdf.php:372
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): WCInvoicePdf\WCInvoicePdf::install()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(693): do_action()

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

An overview of server-side resources used by WC Recurring Invoice Pdf
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.05 ▼1.24
Dashboard /wp-admin3.31 ▲0.0047.50 ▼4.43
Posts /wp-admin/edit.php3.36 ▲0.0055.67 ▲5.64
Add New Post /wp-admin/post-new.php5.89 ▲0.0095.23 ▼6.18
Media Library /wp-admin/upload.php3.23 ▲0.0035.51 ▲1.56

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 90 new files
Database: 1 new table, 6 new options
New tables
wp_ispconfig_invoice
New WordPress options
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

WC Recurring Invoice Pdf: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.16 ▼1.171.68 ▼0.3643.68 ▼4.55
Dashboard /wp-admin2,203 ▲155.94 ▲0.0696.39 ▼12.1937.74 ▼6.51
Posts /wp-admin/edit.php2,089 ▼31.98 ▼0.0538.48 ▼1.3934.79 ▲1.35
Add New Post /wp-admin/post-new.php1,538 ▲1923.26 ▲0.04604.21 ▼63.3549.25 ▼3.83
Media Library /wp-admin/upload.php1,388 ▼04.22 ▲0.0494.65 ▼3.4741.01 ▼3.73

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie tables were found after uninstall: 1 table
    • wp_ispconfig_invoice
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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
Almost there! Just fix the following items
  • 14× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/barcode.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/dummy.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/color.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/encryption.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/imageObjectHash.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/imagetext.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/table-enhancements.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/image.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/imageInTable.php
    • > /wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/examples/tables.php
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/tests/CpdfTest.php:5
    • > CDummyItem
      0
    • > PHP Fatal error
      Uncaught Error: Call to undefined function bcadd() in wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/src/include/TTF.php:1137
    • > CDummyItem
      1
    • > 0.08070182800293
    • > PHP Fatal error
      Uncaught Error: Call to undefined function bcadd() in wp-content/plugins/wc-invoice-pdf/vendor/rospdf/pdf-php/src/include/TTF.php:1137

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
10 plugin tags: automation, order, woocommerce, law, read-only...

wc-invoice-pdf/wc-invoice-pdf.php 92% from 13 tests

The primary PHP file in "WC Recurring Invoice Pdf" version 1.5.18 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.1" instead of "3.0.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected10,671 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP351,5952,2319,916
PO File1960211
JavaScript25327201
Markdown239085
XML31272
JSON20070
SVG10066
YAML26034
Bourne Shell1309
Dockerfile1307

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 169)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity55.97
▷ Minimum class complexity1.00
▷ Maximum class complexity619.00
Average method complexity5.72
▷ Minimum method complexity1.00
▷ Maximum method complexity169.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes32
▷ Abstract classes13.12%
▷ Concrete classes3196.88%
▷ Final classes00.00%
Methods367
▷ Static methods8122.07%
▷ Public methods26471.93%
▷ Protected methods154.09%
▷ Private methods8823.98%
Functions24
▷ Named functions28.33%
▷ Anonymous functions2291.67%
Constants27
▷ Global constants1037.04%
▷ Class constants1762.96%
▷ Public constants17100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
7 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/rospdf/pdf-php/examples/images/test_indexed.png8.12KB8.00KB▼ 1.48%
invoicepdf.png1.01KB0.73KB▼ 27.47%
vendor/rospdf/pdf-php/examples/images/test_indexed_transparent.png7.97KB7.89KB▼ 1.05%
vendor/rospdf/pdf-php/examples/images/test_alpha.png24.23KB8.43KB▼ 65.19%
vendor/rospdf/pdf-php/examples/images/test_grayscaled_alpha.png4.37KB5.04KB0.00%