10% weighty-vote

Code Review | Vote widget

WordPress plugin Vote widget scored 10% from 54 tests.

About plugin

  • Plugin page: weighty-vote
  • Plugin version: 1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.3.1
  • WordPress version: 5.8.1
  • First release: Nov 22, 2017
  • Latest release: Nov 22, 2017
  • Number of updates: 3
  • Update frequency: every 2.0 days
  • Top authors: staminapro (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 401 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/weighty-vote/class.weightyvote_widget.php+9
    Methods with the same name as their class will not be constructors in a future version of PHP; weightyvote_widget has a deprecated constructor

Server metrics [RAM: ▼1.81MB] [CPU: ▼219.03ms] Passed 4 tests

A check of server-side resources used by Vote widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /1.82 ▼0.904.70 ▼15.44
Dashboard /wp-admin1.84 ▼1.226.58 ▼39.08
Posts /wp-admin/edit.php1.84 ▼1.275.84 ▼36.60
Add New Post /wp-admin/post-new.php1.84 ▼3.605.16 ▼773.68
Media Library /wp-admin/upload.php1.84 ▼1.165.22 ▼26.76
Weighty Vote /wp-admin/options-general.php?page=weightyvote_settings1.845.38

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 41 new files
Database: no new tables, 1 new option
New WordPress options
widget_weightyvote_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Vote widget
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,846 ▲25116.35 ▲0.8812.86 ▲0.8145.11 ▲2.17
Dashboard /wp-admin2,985 ▲546.17 ▲0.08157.26 ▼9.40107.82 ▲5.15
Posts /wp-admin/edit.php2,755 ▲162.73 ▲0.0070.17 ▼1.3690.10 ▲0.91
Add New Post /wp-admin/post-new.php1,697 ▲18918.47 ▼0.40371.96 ▼107.24116.60 ▲6.69
Media Library /wp-admin/upload.php1,826 ▲165.06 ▲0.03135.71 ▼19.37116.01 ▼0.47
Weighty Vote /wp-admin/options-general.php?page=weightyvote_settings1,0172.5258.2360.99

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
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/weighty-vote/class.weightyvote_widget.php+9
    Methods with the same name as their class will not be constructors in a future version of PHP; weightyvote_widget has a deprecated constructor
  • The uninstall procedure has failed, leaving 1 option in the database
    • widget_weightyvote_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-content/plugins/weighty-vote/class.weightyvote_widget.php+9
    Methods with the same name as their class will not be constructors in a future version of PHP; weightyvote_widget has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > User deprecated in wp-includes/functions.php+5304
    The called constructor method for WP_Widget in weightyvote_widget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method weightyvote_admin::init() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method weightyvote_admin::create_menu() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method weightyvote_admin::show_settings_page() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-content/plugins/weighty-vote/views/class.weightyvote_settings.php+8
    Methods with the same name as their class will not be constructors in a future version of PHP; weightyvote_settingsView has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > Deprecated in wp-content/plugins/weighty-vote/views/class.weightyvote_select.php+8
    Methods with the same name as their class will not be constructors in a future version of PHP; weightyvote_selectView has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=weightyvote_settings
    • > User notice in wp-includes/functions.php+5663
    WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

SRP 50% 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 fix the following items
  • 5× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/weighty-vote/class.weightyvote_widget.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/weighty-vote/weightyvote.php:35
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/weighty-vote/views/templates/select.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/weighty-vote/views/templates/vote.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/weighty-vote/views/templates/change.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots lack descriptions #2, #3 in weighty-vote/assets to your readme.txt
You can take inspiration from this readme.txt

weighty-vote/weightyvote.php 85% from 13 tests

The main file in "Vote widget" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("weighty-vote.php" instead of "weightyvote.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected3,675 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript94082192,160
PHP11121408689
CSS24132439
SVG100288
PO File1424798
HTML1001

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.14
Average class complexity6.71
▷ Minimum class complexity2.00
▷ Maximum class complexity16.00
Average method complexity1.98
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods41
▷ Static methods2151.22%
▷ Public methods2458.54%
▷ Protected methods00.00%
▷ Private methods1741.46%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants15
▷ Global constants15100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected