78% invoice-for-woocommerce

Code Review | Invoice for WooCommerce

WordPress plugin Invoice for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: invoice-for-wooco...
  • Plugin version: 2.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.0
  • WordPress version: 6.3.1
  • First release: May 25, 2019
  • Latest release: Oct 26, 2022
  • Number of updates: 40
  • Update frequency: every 31.3 days
  • Top authors: seosbg (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

400+ active /6,434 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

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

An overview of server-side resources used by Invoice for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.80 ▼0.60
Dashboard /wp-admin3.31 ▲0.0048.88 ▲1.85
Posts /wp-admin/edit.php3.36 ▲0.0045.04 ▼14.11
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.67 ▼27.00
Media Library /wp-admin/upload.php3.23 ▲0.0034.28 ▲0.58

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Invoice for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,812 ▲6613.24 ▼1.511.70 ▼0.1433.76 ▼9.72
Dashboard /wp-admin2,218 ▲304.88 ▼0.97111.50 ▼4.7244.29 ▲1.39
Posts /wp-admin/edit.php2,101 ▲92.01 ▼0.0034.80 ▼0.7136.51 ▼0.53
Add New Post /wp-admin/post-new.php1,546 ▲1323.19 ▲0.10656.09 ▼1.5650.67 ▼9.06
Media Library /wp-admin/upload.php1,403 ▲154.20 ▼0.0598.21 ▼7.6646.95 ▲0.96

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

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
Good news, no errors were detected

SRP 0% 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 take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/invoice-for-woocommerce/inc/pdf/compress.php
    • > /wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/php-css-parser/tests/quickdump.php
  • 225× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/fonts/dompdf_font_family_cache.php on line 71
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/autoload.inc.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/src/FrameReflower/Inline.php:19
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/fonts/dompdf_font_family_cache.php on line 4
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/fonts/dompdf_font_family_cache.php on line 72
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Style' not found in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/php-svg-lib/src/Svg/DefaultStyle.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Parsing\\SourceException' not found in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Parsing/OutputException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/src/FrameReflower/NullFrameReflower.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/invoice-for-woocommerce/inc/pdf/dompdf/src/FrameDecorator/Text.php:22
    • > PHP Warning
      include_once(): Failed opening '_JPGRAPH_PATHjpgraph_scatter.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/invoice-for-woocommerce/inc/pdf/graph.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
9 plugin tags: pdf, invoice pdf, eu invoice, invoices, woocommerce...

invoice-for-woocommerce/invoice-for-woocommerce.php 92% from 13 tests

The main PHP script in "Invoice for WooCommerce" version 2.1.1 is automatically included on every request by WordPress
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 362 characters long)

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin145,249 lines of code in 404 files:
LanguageFilesBlank linesComment linesLines of code
PHP32214,94222,985141,780
CSS49257941,477
Markdown829901,009
PO File1117118302
XML762210
JSON6120194
JavaScript44026150
YAML5232102
HTML10017
SVG1008

PHP code 0% from 2 tests

Analyzing cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 8,314)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 1,542)
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity110.86
▷ Minimum class complexity1.00
▷ Maximum class complexity8,314.00
Average method complexity9.62
▷ Minimum method complexity1.00
▷ Maximum method complexity1,542.00
Code structure
Namespaces35
Interfaces5
Traits0
Classes210
▷ Abstract classes125.71%
▷ Concrete classes19894.29%
▷ Final classes00.00%
Methods2,819
▷ Static methods1696.00%
▷ Public methods2,50989.00%
▷ Protected methods2318.19%
▷ Private methods792.80%
Functions113
▷ Named functions9785.84%
▷ Anonymous functions1614.16%
Constants536
▷ Global constants519.51%
▷ Class constants48590.49%
▷ Public constants485100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.31MB with 0.16MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
banner-772x250.png224.97KB79.22KB▼ 64.79%
inc/images/remove.png28.49KB13.99KB▼ 50.88%
inc/images/load.png61.33KB18.21KB▼ 70.31%
inc/pdf/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%