67% ni-purchase-orderpo-for-woocommerce

Code Review | Ni Purchase Order(PO) For WooCommerce

WordPress plugin Ni Purchase Order(PO) For WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: ni-purchase-order...
  • Plugin version: 1.2.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.1.1
  • WordPress version: 6.3.1
  • First release: Jan 23, 2021
  • Latest release: Feb 19, 2023
  • Number of updates: 15
  • Update frequency: every 50.5 days
  • Top authors: anzia (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /956 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.03MB] [CPU: ▼5.16ms] Passed 4 tests

Server-side resources used by Ni Purchase Order(PO) For WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0238.74 ▼0.49
Dashboard /wp-admin3.33 ▲0.0342.43 ▼8.16
Posts /wp-admin/edit.php3.44 ▲0.0954.43 ▲8.31
Add New Post /wp-admin/post-new.php5.91 ▲0.0379.25 ▼9.46
Media Library /wp-admin/upload.php3.25 ▲0.0331.34 ▼2.54
Dashboard /wp-admin/admin.php?page=niwoopo-dashboard3.3035.80
Manage PO /wp-admin/admin.php?page=niwoopo-manage-po3.3032.19
Setting /wp-admin/admin.php?page=niwoopo-setting3.3828.90
Stock Report /wp-admin/admin.php?page=niwoopo-stock-report3.4028.28

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 382 new files
Database: 2 new tables, 6 new options
New tables
wp_niwoopo_detail
wp_niwoopo_header
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Ni Purchase Order(PO) For WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,831 ▲8514.47 ▲0.171.92 ▲0.0943.64 ▼3.88
Dashboard /wp-admin2,234 ▲435.83 ▲0.9393.61 ▼22.6440.42 ▼8.82
Posts /wp-admin/edit.php2,120 ▲342.01 ▼0.1239.77 ▲5.3535.45 ▼1.82
Add New Post /wp-admin/post-new.php1,558 ▲2522.96 ▼0.14640.59 ▼37.2561.42 ▲10.15
Media Library /wp-admin/upload.php1,419 ▲344.22 ▼0.0093.12 ▼14.5842.62 ▼2.90
Dashboard /wp-admin/admin.php?page=niwoopo-dashboard9701.8428.1157.86
Manage PO /wp-admin/admin.php?page=niwoopo-manage-po9732.3437.6634.14
Setting /wp-admin/admin.php?page=niwoopo-setting1,0901.8728.2926.20
Stock Report /wp-admin/admin.php?page=niwoopo-stock-report1,1742.4635.2734.10

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_niwoopo_header
    • wp_niwoopo_detail
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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 fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-css-parser/tests/quickdump.php
  • 135× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/src/Adapter/GD.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/src/FrameReflower/Text.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/src/Adapter/CPDF.php:38
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\AbstractTag' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-svg-lib/src/Svg/Tag/ClipPath.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\BinaryStream' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-font-lib/src/FontLib/TrueType/Collection.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Glyph\\Outline' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-font-lib/src/FontLib/Glyph/OutlineComposite.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/src/Positioner/TableCell.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Property\\AtRule' not found in wp-content/plugins/ni-purchase-orderpo-for-woocommerce/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Property/Charset.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
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 important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Dashboard show sales report and key sale indicator), #2 (Add purchase order list), #3 (Add purchase order), #4 (Edit purchase order), #5 (Purchase order settings), #6 (Purchase order print.), #7 (Purchase order PDF.), #8 (Stock Report)
The official readme.txt might help

ni-purchase-orderpo-for-woocommerce/ni-purchase-order-for-woocommerce.php 92% from 13 tests

The main PHP script in "Ni Purchase Order(PO) For WooCommerce" version 1.2.1 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("ni-purchase-orderpo-for-woocommerce.php" instead of "ni-purchase-order-for-woocommerce.php")

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
There were no executable files found in this plugin57,038 lines of code in 289 files:
LanguageFilesBlank linesComment linesLines of code
PHP2089,09515,53352,182
CSS504112982,770
Markdown62650947
JavaScript720357658
XML632194
JSON500154
YAML419286
SVG20130
HTML10017

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
The following items need your attention
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity36.32
▷ Minimum class complexity1.00
▷ Maximum class complexity797.00
Average method complexity4.39
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces33
Interfaces5
Traits0
Classes191
▷ Abstract classes126.28%
▷ Concrete classes17993.72%
▷ Final classes00.00%
Methods2,114
▷ Static methods1024.82%
▷ Public methods1,83086.57%
▷ Protected methods2109.93%
▷ Private methods743.50%
Functions15
▷ Named functions00.00%
▷ Anonymous functions15100.00%
Constants176
▷ Global constants21.14%
▷ Class constants17498.86%
▷ Public constants174100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
16 PNG files occupy 0.75MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png72.58KB17.28KB▼ 76.20%
admin/css/images/ui-icons_777777_256x240.png3.19KB3.49KB0.00%
screenshot-4.png105.32KB26.42KB▼ 74.92%
admin/css/images/ui-icons_444444_256x240.png3.19KB3.49KB0.00%
screenshot-8.png109.78KB29.42KB▼ 73.20%