74% random-winner

Code Review | Random Winner

WordPress plugin Random Winner scored74%from 54 tests.

About plugin

  • Plugin page: random-winner
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.4
  • WordPress version: 6.3.1
  • First release: Sep 4, 2015
  • Latest release: Dec 14, 2015
  • Number of updates: 7
  • Update frequency: every 14.4 days
  • Top authors: AnjitVishwakarma (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /648 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.80ms] Passed 4 tests

A check of server-side resources used by Random Winner
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0339.38 ▼7.40
Dashboard /wp-admin3.34 ▼0.0153.38 ▼8.99
Posts /wp-admin/edit.php3.39 ▲0.0355.21 ▲3.28
Add New Post /wp-admin/post-new.php5.94 ▲0.0598.83 ▼3.97
Media Library /wp-admin/upload.php3.26 ▲0.0337.53 ▲1.15

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 6 new files
Database: 1 new table, 6 new options
New tables
wp_aj_winners
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Random Winner
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲4514.24 ▼0.481.75 ▲0.0442.51 ▲1.61
Dashboard /wp-admin2,215 ▲355.65 ▲0.0388.02 ▼6.7284.72 ▲45.81
Posts /wp-admin/edit.php2,120 ▲202.02 ▼0.0137.15 ▼3.9133.30 ▼7.21
Add New Post /wp-admin/post-new.php1,694 ▲16822.44 ▼0.51732.01 ▲85.9651.73 ▲3.63
Media Library /wp-admin/upload.php1,414 ▲174.21 ▲0.01103.49 ▼3.1777.71 ▲32.15

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
These items require your attention
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_aj_winners
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded

Smoke tests 75% 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 everything seems fine, this is not an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/random-winner/winners.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
2 plugin tags: choose winner, winners

random-winner/winners.php 92% from 13 tests

The principal PHP file in "Random Winner" v. 1.0 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("random-winner.php" instead of "winners.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected199 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP1910170
JavaScript14029

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.25
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%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
2 PNG files occupy 0.06MB with 0.02MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
ico.png1.34KB1.28KB▼ 4.51%
Trophy.png60.20KB18.18KB▼ 69.80%