78% ni-woocommerce-invoice

Code Review | Ni WooCommerce Invoice

WordPress plugin Ni WooCommerce Invoice scored78%from 54 tests.

About plugin

  • Plugin page: ni-woocommerce-in...
  • Plugin version: 1.5.7
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.1.1
  • WordPress version: 6.3.1
  • First release: Oct 21, 2015
  • Latest release: Feb 19, 2023
  • Number of updates: 22
  • Update frequency: every 121.8 days
  • Top authors: anzia (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,554 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
Installer ran successfully

Server metrics [RAM: ▲0.05MB] [CPU: ▼2.05ms] Passed 4 tests

Analyzing server-side resources used by Ni WooCommerce Invoice
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0444.00 ▲2.27
Dashboard /wp-admin3.36 ▲0.0547.64 ▼0.33
Posts /wp-admin/edit.php3.47 ▲0.1150.86 ▲1.79
Add New Post /wp-admin/post-new.php5.94 ▲0.0593.06 ▼11.77
Media Library /wp-admin/upload.php3.28 ▲0.0535.59 ▲2.10
Order List /wp-admin/admin.php?page=ni-woocommerce-invoice3.2729.25
Addons /wp-admin/admin.php?page=ni-addons3.2632.06
Setting /wp-admin/admin.php?page=ni-invoice-setting3.2530.85

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 334 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Ni WooCommerce Invoice
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,826 ▲9114.81 ▲0.141.84 ▼0.2646.87 ▲7.01
Dashboard /wp-admin2,229 ▲415.99 ▲0.1396.60 ▼15.0685.78 ▲42.37
Posts /wp-admin/edit.php2,115 ▲232.01 ▼0.0438.60 ▼1.0834.33 ▲1.25
Add New Post /wp-admin/post-new.php1,545 ▲3123.03 ▲5.28709.20 ▲26.8469.89 ▲7.51
Media Library /wp-admin/upload.php1,417 ▲294.25 ▲0.05111.86 ▲9.5147.66 ▲5.27
Order List /wp-admin/admin.php?page=ni-woocommerce-invoice8692.1232.3227.04
Addons /wp-admin/admin.php?page=ni-addons1,1762.0122.5933.19
Setting /wp-admin/admin.php?page=ni-invoice-setting8322.1625.7127.13

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/tests/quickdump.php
  • 130× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\Shape' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-svg-lib/src/Svg/Tag/Circle.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\ValueList' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Value/RuleValueList.php:5
    • > PHP Notice
      Undefined variable: rootDir in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/fonts/dompdf_font_family_cache.dist.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/src/FrameDecorator/TableRowGroup.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\PrimitiveValue' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\CSSList\\CSSBlockList' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/src/FrameDecorator/Text.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\RuleSet\\RuleSet' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\AbstractTag' not found in wp-content/plugins/ni-woocommerce-invoice/dompdf/lib/php-svg-lib/src/Svg/Tag/StyleTag.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (Order List With filter option.), #2 (Settings Options.)
You can look at the official readme.txt

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

The principal PHP file in "Ni WooCommerce Invoice" v. 1.5.7 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 235 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin40,246 lines of code in 257 files:
LanguageFilesBlank linesComment linesLines of code
PHP2018,36315,24638,168
Markdown62550909
CSS3214367722
XML632201
JSON500139
YAML416365
HTML10017
JavaScript13217
SVG1008

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity34.66
▷ Minimum class complexity1.00
▷ Maximum class complexity765.00
Average method complexity4.27
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces33
Interfaces5
Traits0
Classes183
▷ Abstract classes126.56%
▷ Concrete classes17193.44%
▷ Final classes00.00%
Methods1,997
▷ Static methods814.06%
▷ Public methods1,70985.58%
▷ Protected methods1929.61%
▷ Private methods964.81%
Functions15
▷ Named functions00.00%
▷ Anonymous functions15100.00%
Constants157
▷ Global constants21.27%
▷ Class constants15598.73%
▷ Public constants155100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
5 PNG files occupy 0.28MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png130.12KB32.88KB▼ 74.73%
screenshot-3.png66.94KB19.41KB▼ 71.00%
images/icon.png0.66KB0.66KB0.44%
screenshot-1.png87.87KB26.82KB▼ 69.48%
dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%