57% yet-another-stars-rating

Code Review | YASR - Yet Another Star Rating Plugin for WordPress

WordPress plugin YASR - Yet Another Star Rating Plugin for WordPress scored57%from 54 tests.

About plugin

  • Plugin page: yet-another-stars...
  • Plugin version: 3.4.7
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Jun 4, 2014
  • Latest release: Nov 9, 2023
  • Number of updates: 895
  • Update frequency: every 3.9 days
  • Top authors: Dudo (98.44%)paretodigital (1.68%)

Code review

54 tests

User reviews

316 reviews

Install metrics

20,000+ active /1,778,979 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲5.36MB] [CPU: ▲36.96ms] 75% from 4 tests

Server-side resources used by YASR - Yet Another Star Rating Plugin for WordPress
Please take the time to fix the following items
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 5.36MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.92 ▲5.4568.00 ▲26.43
Dashboard /wp-admin8.94 ▲5.6382.71 ▲33.89
Posts /wp-admin/edit.php8.94 ▲5.5887.97 ▲40.97
Add New Post /wp-admin/post-new.php10.65 ▲4.76133.42 ▲46.55
Media Library /wp-admin/upload.php8.94 ▲5.7180.42 ▲47.92
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius8.9466.73

Server storage [IO: ▲5.49MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 371 new files
Database: 4 new tables, 16 new options
New tables
wp_yasr_multi_set
wp_yasr_multi_set_fields
wp_yasr_log_multi_set
wp_yasr_log
New WordPress options
db_upgraded
yasr_general_options
theysaidso_admin_options
fs_active_plugins
yasr_style_options
widget_yasr_overall_rating_widget
widget_yasr_visitor_votes_widget
yasr_multiset_options
can_compress_scripts
widget_recent-comments
...

Browser metrics Passed 4 tests

A check of browser resources used by YASR - Yet Another Star Rating Plugin for WordPress
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,908 ▲14613.52 ▼0.821.66 ▼0.1532.00 ▼14.99
Dashboard /wp-admin2,304 ▲1245.60 ▼0.00100.98 ▲4.9254.69 ▲12.02
Posts /wp-admin/edit.php2,150 ▲502.07 ▲0.0640.99 ▲0.1739.97 ▲4.01
Add New Post /wp-admin/post-new.php2,560 ▲1,03425.67 ▲2.77744.04 ▲75.6356.10 ▲2.33
Media Library /wp-admin/upload.php1,439 ▲394.15 ▼0.0797.88 ▼11.4444.71 ▼0.29
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,1011.6525.1626.90

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/yet-another-stars-rating/vendor/freemius/wordpress-sdk/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • The plugin did not uninstall successfully, leaving 4 tables in the database
    • wp_yasr_multi_set
    • wp_yasr_log
    • wp_yasr_multi_set_fields
    • wp_yasr_log_multi_set
  • Zombie WordPress options detected upon uninstall: 16 options
    • widget_yasr_visitor_votes_widget
    • theysaidso_admin_options
    • yasr-version
    • yasr_style_options
    • fs_active_plugins
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • yasr_general_options
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 46× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/yet-another-stars-rating/includes/classes/YasrCustomPostTypes.php
    • > /wp-content/plugins/yet-another-stars-rating/includes/shortcodes/classes/YasrVisitorVotes.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/classes/YasrEditCategory.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/settings/classes/YasrSettingsRankings.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/yasr-admin-init.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/settings/classes/YasrImportRatingPlugins.php
    • > /wp-content/plugins/yet-another-stars-rating/includes/shortcodes/classes/YasrNoStarsRankings.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/editor/YasrMetaboxBelowEditor.php
    • > /wp-content/plugins/yet-another-stars-rating/admin/editor/YasrEditorHooks.php
    • > /wp-content/plugins/yet-another-stars-rating/includes/shortcodes/classes/YasrOverallRating.php
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Gamajo_Template_Loader' not found in wp-content/plugins/yet-another-stars-rating/includes/classes/YasrTemplateLoader.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'YasrShortcode' not found in wp-content/plugins/yet-another-stars-rating/includes/shortcodes/classes/YasrDisplayPosts.php:16
    • > PHP Warning
      require_once(wp-content/plugins/yet-another-stars-rating/vendor/composer/autoload_real.php): failed to open stream: No such file or directory in wp-content/plugins/yet-another-stars-rating/vendor/autoload.php on line 23
    • > PHP Warning
      file_get_contents(docs/yasr_hooks.md): failed to open stream: No such file or directory in wp-content/plugins/yet-another-stars-rating/docs/fix_yasr_hooks_path.php on line 8
    • > PHP Warning
      file_put_contents(docs/yasr_hooks.md): failed to open stream: No such file or directory in wp-content/plugins/yet-another-stars-rating/docs/fix_yasr_hooks_path.php on line 14
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/yet-another-stars-rating/vendor/composer/autoload_real.php' (include_path='.:/usr/share/php') in wp-content/plugins/yet-another-stars-rating/vendor/autoload.php on line 23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_ID() in wp-content/plugins/yet-another-stars-rating/templates/content.php:11

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% 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: Please take inspiration from this readme.txt

yet-another-stars-rating/yet-another-stars-rating.php 92% from 13 tests

"YASR - Yet Another Star Rating Plugin for WordPress" version 3.4.7's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 145 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin53,658 lines of code in 269 files:
LanguageFilesBlank linesComment linesLines of code
PHP18010,75722,99043,941
JavaScript488401,0063,734
PO File31,1591,4162,798
CSS18349701,480
SVG812900
Markdown32800502
JSON800217
HTML114186

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity57.79
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.16
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes95
▷ Abstract classes33.16%
▷ Concrete classes9296.84%
▷ Final classes00.00%
Methods1,746
▷ Static methods29817.07%
▷ Public methods1,25471.82%
▷ Protected methods482.75%
▷ Private methods44425.43%
Functions155
▷ Named functions13285.16%
▷ Anonymous functions2314.84%
Constants230
▷ Global constants18379.57%
▷ Class constants4720.43%
▷ Public constants47100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
51 PNG files occupy 0.93MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/img/stars/thumb/6fork_second.png1.36KB1.38KB0.00%
includes/img/stars/thumb/1rater.png1.07KB1.54KB0.00%
includes/img/yasr-multi-set-insert-rating.png124.83KB54.94KB▼ 55.99%
includes/img/stars/thumb/24joy.png31.54KB18.17KB▼ 42.39%
includes/img/stars/thumb/11camera.png29.28KB16.16KB▼ 44.82%