68% scratch-and-win

Code Review | Scratch and Win

WordPress plugin Scratch and Win scored68%from 54 tests.

About plugin

  • Plugin page: scratch-and-win
  • Plugin version: 1.1.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3.0-6.1
  • WordPress version: 6.3.1
  • First release: Mar 14, 2022
  • Latest release: Feb 3, 2023
  • Number of updates: 28
  • Update frequency: every 12.0 days
  • Top authors: sosidee (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

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

Server metrics [RAM: ▲1.05MB] [CPU: ▲8.15ms] Passed 4 tests

A check of server-side resources used by Scratch and Win
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.09 ▲0.6343.05 ▼2.90
Dashboard /wp-admin4.48 ▲1.1768.66 ▲14.40
Posts /wp-admin/edit.php4.59 ▲1.2359.20 ▲8.51
Add New Post /wp-admin/post-new.php7.06 ▲1.17107.22 ▲12.59
Media Library /wp-admin/upload.php4.48 ▲1.2558.66 ▲21.10
Games /wp-admin/admin.php?page=sos-scratch-and-win-04.8458.25
Tickets /wp-admin/admin.php?page=sos-scratch-and-win-34.8561.47
sos-scratch-and-win-2 /wp-admin/admin.php?page=sos-scratch-and-win-24.7145.94
Statistics /wp-admin/admin.php?page=sos-scratch-and-win-44.8565.45
sos-scratch-and-win-1 /wp-admin/admin.php?page=sos-scratch-and-win-14.92101.62

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 99 new files
Database: 3 new tables, 7 new options
New tables
wp_sos_saw_prizes
wp_sos_saw_tickets
wp_sos_saw_games
New WordPress options
theysaidso_admin_options
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
sos-scratch-and-win_db-version

Browser metrics Passed 4 tests

Scratch and Win: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,820 ▲3414.31 ▼0.161.68 ▼0.2042.81 ▼1.41
Dashboard /wp-admin2,226 ▲525.58 ▼0.0988.01 ▼16.3344.22 ▼5.61
Posts /wp-admin/edit.php2,134 ▲311.99 ▼0.0333.23 ▼5.3231.55 ▼4.08
Add New Post /wp-admin/post-new.php1,562 ▲3617.95 ▼5.11680.88 ▲15.9667.88 ▲8.00
Media Library /wp-admin/upload.php1,428 ▲344.19 ▼0.01108.02 ▲3.4948.06 ▲1.68
Games /wp-admin/admin.php?page=sos-scratch-and-win-09092.0525.0927.00
Tickets /wp-admin/admin.php?page=sos-scratch-and-win-31,0432.0021.0323.82
sos-scratch-and-win-2 /wp-admin/admin.php?page=sos-scratch-and-win-27091.336.9622.46
Statistics /wp-admin/admin.php?page=sos-scratch-and-win-49732.0226.2633.09
sos-scratch-and-win-1 /wp-admin/admin.php?page=sos-scratch-and-win-11,6402.9940.6475.75

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The uninstall procedure failed, leaving 3 tables in the database
    • wp_sos_saw_tickets
    • wp_sos_saw_games
    • wp_sos_saw_prizes
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • sos-scratch-and-win_db-version
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 59× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/scratch-and-win/sos/wp/email.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/data/field.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/data/formfile.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/functions.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/data/db.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/data/wpdatabase.php
    • > /wp-content/plugins/scratch-and-win/src/gamestatus.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/elementor/widget.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/data/formfield.php
    • > /wp-content/plugins/scratch-and-win/sos/wp/be/menu.php
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'SOSIDEE_SAW\\SosPlugin' not found in wp-content/plugins/scratch-and-win/admin/prize.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'SOSIDEE_SAW\\SosPlugin' not found in wp-content/plugins/scratch-and-win/admin/tickets.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'SOSIDEE_SAW\\SosPlugin' not found in wp-content/plugins/scratch-and-win/admin/game.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'SOSIDEE_SAW\\SosPlugin' not found in wp-content/plugins/scratch-and-win/admin/games.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'SOSIDEE_SAW\\SosPlugin' not found in wp-content/plugins/scratch-and-win/admin/stats.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
Please take inspiration from this readme.txt

scratch-and-win/scratch-and-win.php 92% from 13 tests

The main PHP file in "Scratch and Win" ver. 1.1.2 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Domain Path: The domain path points to a folder that does not exist ("/languages")

Code Analysis Passed 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
No dangerous file extensions were detected8,888 lines of code in 72 files:
LanguageFilesBlank linesComment linesLines of code
PHP641,5299798,170
JavaScript511162644
CSS26473
HTML1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity17.74
▷ Minimum class complexity1.00
▷ Maximum class complexity98.00
Average method complexity2.74
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces8
Interfaces0
Traits5
Classes52
▷ Abstract classes11.92%
▷ Concrete classes5198.08%
▷ Final classes00.00%
Methods514
▷ Static methods7314.20%
▷ Public methods38775.29%
▷ Protected methods6011.67%
▷ Private methods6713.04%
Functions39
▷ Named functions1743.59%
▷ Anonymous functions2256.41%
Constants66
▷ Global constants11.52%
▷ Class constants6598.48%
▷ Public constants65100.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
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/coin.png8.46KB2.04KB▼ 75.94%