66% user-awards

Code Review | User Awards

WordPress plugin User Awards scored66%from 54 tests.

About plugin

  • Plugin page: user-awards
  • Plugin version: 0.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1.1-5.2.2
  • WordPress version: 6.3.1
  • First release: May 24, 2019
  • Latest release: Jul 25, 2019
  • Number of updates: 23
  • Update frequency: every 2.8 days
  • Top authors: kwmartin (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /679 total downloads

Benchmarks

Plugin footprint 83% 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: ▲0.27MB] [CPU: ▲0.53ms] Passed 4 tests

A check of server-side resources used by User Awards
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2137.95 ▲1.54
Dashboard /wp-admin3.64 ▲0.3347.24 ▲0.71
Posts /wp-admin/edit.php3.69 ▲0.3349.15 ▼0.28
Add New Post /wp-admin/post-new.php6.17 ▲0.28100.72 ▲0.15
Media Library /wp-admin/upload.php3.51 ▲0.2738.04 ▲5.80
User Awards /wp-admin/edit.php?post_type=user_awards_cpt&page=user-awards-admin-view3.4834.99
Awards /wp-admin/edit.php?post_type=user_awards_cpt3.5539.95
Add New Award /wp-admin/post-new.php?post_type=user_awards_cpt3.6948.97

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 29 new files
Database: 1 new table, 8 new options
New tables
wp_user_awards
New WordPress options
recovery_mode_email_last_sent
db_upgraded
theysaidso_admin_options
user_awards_version
widget_recent-posts
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for User Awards
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,885 ▲13913.26 ▼1.301.67 ▲0.1240.27 ▼2.69
Dashboard /wp-admin2,291 ▲1035.84 ▲0.9495.84 ▼8.8179.49 ▲35.23
Posts /wp-admin/edit.php2,130 ▲382.11 ▲0.1050.05 ▲9.3434.60 ▲0.09
Add New Post /wp-admin/post-new.php1,610 ▲7723.16 ▼0.13717.87 ▲105.3456.27 ▼6.08
Media Library /wp-admin/upload.php1,475 ▲844.18 ▼0.01110.80 ▲10.6045.46 ▲3.12
User Awards /wp-admin/edit.php?post_type=user_awards_cpt&page=user-awards-admin-view9072.0725.4423.22
Awards /wp-admin/edit.php?post_type=user_awards_cpt1,1512.0030.9829.71
Add New Award /wp-admin/post-new.php?post_type=user_awards_cpt1,4861.9122.2635.76

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 7 options in the database
    • recovery_mode_email_last_sent
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
    • > GET request to /wp-admin/post-new.php?post_type=user_awards_cpt
    • > Error in wp-content/plugins/user-awards/src/Grammar/Trigger.php+58
    Uncaught InvalidArgumentException: Trigger control must be a numeric if you're not testing equality in wp-content/plugins/user-awards/src/Grammar/Trigger.php:58
    Stack trace:
    #0 wp-content/plugins/user-awards/src/Grammar/Trigger.php(79): UserAwards\Grammar\Trigger->validateTriggerControl()
    #1 wp-content/plugins/user-awards/src/Grammar/AutoParser.php(12): UserAwards\Grammar\Trigger->parse()
    #2 wp-content/plugins/user-awards/src/Grammar/Trigger.php(27): UserAwards\Grammar\AutoParser->__construct()
    #3 wp-content/plugins/user-awards/src/Grammar/PluginParser.php(18): UserAwards\Grammar\Trigger->__construct()
    #4 wp-content/plugins/user-awards/src/Grammar/PluginParser.php(35): UserAwards\Grammar\PluginParser->setDefaultValues()
    #5 wp-content/plugins/user-awards/src/PluginLogic/PostType/MetaBoxes.php(131): UserAwards\Grammar\PluginParser->parse()
    #6 wp-admin/includes/t

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 take a closer look at the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/user-awards/user_awards.php
  • 7× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/user-awards/src/PluginLogic/UserAwardsTable.php on line 6
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/user-awards/src/PluginLogic/UserAwardsTable.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'UserAwards\\Grammar\\AutoParser' not found in wp-content/plugins/user-awards/src/Grammar/TriggerDescriptor.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'UserAwards\\Grammar\\ParserInterface' not found in wp-content/plugins/user-awards/src/Grammar/Core.php:44
    • > PHP Fatal error
      Uncaught Error: Class 'UserAwards\\Grammar\\Core' not found in wp-content/plugins/user-awards/src/Grammar/PluginParser.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'UserAwards\\Grammar\\AutoParser' not found in wp-content/plugins/user-awards/src/Grammar/Trigger.php:23
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/user-awards/src/PluginLogic/UserAwardsTable.php on line 6

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There are user-side issues you should fix
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=user_awards_cpt
    • > Network (severe)
    wp-content/plugins/user-awards/assets/icons/icon-16x16.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Donate link: Invalid url: "N/A"
Please take inspiration from this readme.txt

user-awards/user_awards.php 85% from 13 tests

Analyzing the main PHP file in "User Awards" version 0.1.1
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("user-awards.php" instead of "user_awards.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 293 characters long)

Code Analysis Passed 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 plugin1,765 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
PHP223646331,622
JavaScript2243483
CSS1181159
JSON1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity11.44
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.45
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces7
Interfaces1
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods104
▷ Static methods1110.58%
▷ Public methods9490.38%
▷ Protected methods00.00%
▷ Private methods109.62%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants13
▷ Global constants13100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin