78% really-simple-packing-slips-pdf

Code Review | Really Simple Packing Slips PDF

WordPress plugin Really Simple Packing Slips PDF scored78%from 54 tests.

About plugin

  • Plugin page: really-simple-pac...
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.6
  • WordPress version: 6.3.1
  • First release: Feb 25, 2021
  • Latest release: Feb 25, 2021
  • Number of updates: 3
  • Update frequency: N/A
  • Top authors: jaan1234 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /740 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

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

Analyzing server-side resources used by Really Simple Packing Slips PDF
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0141.86 ▼0.20
Dashboard /wp-admin3.32 ▼0.0349.90 ▼17.62
Posts /wp-admin/edit.php3.37 ▲0.0149.34 ▲3.75
Add New Post /wp-admin/post-new.php5.90 ▲0.0184.05 ▼17.78
Media Library /wp-admin/upload.php3.24 ▲0.0140.84 ▲6.33

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Really Simple Packing Slips PDF
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.22 ▼0.061.58 ▼0.1146.67 ▲3.37
Dashboard /wp-admin2,195 ▲155.63 ▼0.0184.44 ▼5.9638.88 ▼4.02
Posts /wp-admin/edit.php2,100 ▼01.98 ▼0.0035.35 ▼4.6334.02 ▼0.66
Add New Post /wp-admin/post-new.php1,526 ▼1123.63 ▲5.22680.21 ▲30.2556.52 ▲0.35
Media Library /wp-admin/upload.php1,403 ▲34.23 ▲0.05101.42 ▼4.8144.66 ▼2.98

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

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
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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-css-parser/tests/quickdump.php
  • 133× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\Table' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-font-lib/src/FontLib/Table/Type/hhea.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\Value' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Value/ValueList.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Svg\\Surface\\SurfaceInterface' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-svg-lib/src/Svg/Surface/SurfacePDFLib.php:40
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/src/Adapter/PDFLib.php:100
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/src/Positioner/Fixed.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\Table' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-font-lib/src/FontLib/Table/Type/hmtx.php:49
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Property\\AtRule' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/Property/Import.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/src/FrameDecorator/Page.php:64
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/src/Positioner/NullPositioner.php:52
    • > PHP Fatal error
      Uncaught Error: Interface 'Svg\\Surface\\SurfaceInterface' not found in wp-content/plugins/really-simple-packing-slips-pdf/includes/dompdf/lib/php-svg-lib/src/Svg/Surface/SurfaceCpdf.php:40

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% 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
5 plugin tags: packing slips, packing list, pdf, orders, woocommerce

really-simple-packing-slips-pdf/really_simple_packing_slips_pdf.php 85% from 13 tests

The main PHP file in "Really Simple Packing Slips PDF" ver. 1.0.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Name the main plugin file the same as the plugin slug ("really-simple-packing-slips-pdf.php" instead of "really_simple_packing_slips_pdf.php")

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
Success! There were no dangerous files found in this plugin40,167 lines of code in 264 files:
LanguageFilesBlank linesComment linesLines of code
PHP1988,54015,45838,061
Markdown62650947
CSS4313760700
XML632194
JSON500154
YAML419286
HTML10017
SVG1008

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity36.39
▷ Minimum class complexity1.00
▷ Maximum class complexity797.00
Average method complexity4.34
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces33
Interfaces5
Traits0
Classes182
▷ Abstract classes126.59%
▷ Concrete classes17093.41%
▷ Final classes00.00%
Methods2,049
▷ Static methods1024.98%
▷ Public methods1,76586.14%
▷ Protected methods21010.25%
▷ Private methods743.61%
Functions16
▷ Named functions00.00%
▷ Anonymous functions16100.00%
Constants178
▷ Global constants42.25%
▷ Class constants17497.75%
▷ Public constants174100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
includes/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%