68% raffle-ticket-generator

Code Review | Raffle Ticket Generator - Woocommerce

WordPress plugin Raffle Ticket Generator - Woocommerce scored68%from 54 tests.

About plugin

  • Plugin page: raffle-ticket-gen...
  • Plugin version: 4.7.3.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.2-6.3.2
  • WordPress version: 6.3.1
  • First release: Nov 17, 2015
  • Latest release: Oct 30, 2023
  • Number of updates: 62
  • Update frequency: every 47.6 days
  • Top authors: teoleonard (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

400+ active /21,593 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼7.56ms] Passed 4 tests

This is a short check of server-side resources used by Raffle Ticket Generator - Woocommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0838.43 ▼2.61
Dashboard /wp-admin3.39 ▲0.0445.29 ▼15.94
Posts /wp-admin/edit.php3.44 ▲0.0847.56 ▼1.45
Add New Post /wp-admin/post-new.php5.99 ▲0.1080.75 ▼10.23
Media Library /wp-admin/upload.php3.31 ▲0.0836.72 ▲2.27
View Customer's Ticket Numbers /wp-admin/admin.php?page=woocommerce-raffle-tickets3.2932.66
Raffle Ticket Generator /wp-admin/admin.php?page=woocommerce-raffle3.2831.62

Server storage [IO: ▲2.64MB] [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: 35 new files
Database: 1 new table, 6 new options
New tables
wp_wooraffle_tickets_customer_to_tickets
New WordPress options
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

Raffle Ticket Generator - Woocommerce: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,824 ▲7814.37 ▲0.001.78 ▲0.0937.96 ▼4.20
Dashboard /wp-admin2,230 ▲505.65 ▲0.0789.49 ▼0.9933.14 ▼8.07
Posts /wp-admin/edit.php2,138 ▲382.03 ▲0.0641.20 ▲5.6333.04 ▼3.32
Add New Post /wp-admin/post-new.php1,556 ▲1923.16 ▲4.72642.53 ▲41.6354.67 ▼6.85
Media Library /wp-admin/upload.php1,435 ▲324.38 ▲0.1695.80 ▼5.7739.72 ▼5.09
View Customer's Ticket Numbers /wp-admin/admin.php?page=woocommerce-raffle-tickets8432.2933.5528.00
Raffle Ticket Generator /wp-admin/admin.php?page=woocommerce-raffle1,1472.0126.8138.51

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_wooraffle_tickets_customer_to_tickets
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/raffle-ticket-generator/raffle-ticket-generator.php:47

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=woocommerce-raffle
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).accordion is not a function" "TypeError: jQuery(...).accordion is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/raffle-ticket-generator/includes/js/script.js?ver=6.3.1:2:28)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=woocommerce-raffle
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: jQuery(...).accordion is not a function

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Screenshots: Screenshot #1 (This screenshot shows the product configuration in WooCommerce. When the plugin is installed, the product editor will show a "Number of Raffle Tickets" field. Leave it blank for normal products without a raffle ticket, if you want it to be a raffle ticket item, then put in the appropriate number. In this example it is 50 - this product will generate 50 tickets.) image not found
The official readme.txt is a good inspiration

raffle-ticket-generator/raffle-ticket-generator.php 92% from 13 tests

This is the main PHP file of "Raffle Ticket Generator - Woocommerce" version 4.7.3.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("3.0.1" instead of "2.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected14,826 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript42,4331,82612,748
CSS22,04941,673
PHP122136393
XML20012

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions17
▷ Named functions17100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
15 PNG files occupy 0.52MB with 0.29MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/bronze-settings.png15.76KB8.67KB▼ 44.98%
tickets/ticket_1.png4.14KB0.81KB▼ 80.53%
screen.png92.34KB41.56KB▼ 54.99%
tickets/start-red.png4.94KB2.48KB▼ 49.80%
tickets/ticket_3.png7.09KB3.87KB▼ 45.43%