10% sn-rating

Code Review | SN Rating

WordPress plugin SN Rating scored10%from 54 tests.

About plugin

  • Plugin page: sn-rating
  • Plugin version: 1.4.7
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-3.8
  • WordPress version: 6.3.1
  • First release: Mar 19, 2013
  • Latest release: Dec 26, 2013
  • Number of updates: 98
  • Update frequency: every 2.9 days
  • Top authors: pgautam (97.96%)diveshkumar (3.06%)

Code review

54 tests

User reviews

18 reviews

Install metrics

10+ active /13,043 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The following installer errors require your attention
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/sn-rating/sn_rating.php+296
    Function create_function() is deprecated

Server metrics [RAM: ▼1.49MB] [CPU: ▼50.69ms] Passed 4 tests

This is a short check of server-side resources used by SN Rating
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.49 ▼0.976.90 ▼33.50
Dashboard /wp-admin2.51 ▼0.799.76 ▼38.44
Posts /wp-admin/edit.php2.51 ▼0.848.47 ▼45.26
Add New Post /wp-admin/post-new.php2.51 ▼3.378.05 ▼85.55
Media Library /wp-admin/upload.php2.51 ▼0.728.84 ▼29.38
Rating Settings /wp-admin/options-general.php?page=rating_options2.528.71

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 345 new files
Database: 5 new tables, 8 new options
New tables
wp_rating_factors
wp_entity_rating_factors
wp_rating_scores
wp_rating_meta
wp_admin_rating_config
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts
widget_rating_widget
widget_theysaidso_widget
rating_db_version

Browser metrics Passed 4 tests

This is an overview of browser requirements for SN Rating
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,964 ▲17813.73 ▼0.5510.11 ▲7.0838.08 ▼3.00
Dashboard /wp-admin2,232 ▲555.83 ▲0.1785.78 ▼0.2979.37 ▲43.23
Posts /wp-admin/edit.php2,149 ▲522.44 ▲0.4835.64 ▼1.1737.05 ▲0.21
Add New Post /wp-admin/post-new.php1,570 ▲4223.24 ▲0.14626.37 ▼70.3238.59 ▼23.99
Media Library /wp-admin/upload.php1,446 ▲524.51 ▲0.3795.06 ▼7.7845.67 ▼0.37
Rating Settings /wp-admin/options-general.php?page=rating_options1,0041.7229.8235.51

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the rating-styles handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_rating_scores
  • The uninstall procedure has failed, leaving 8 options in the database
    • rating_db_version
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_rating_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the rating-styles handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the rating handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery-ui-lightness handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery-ui-datepicker handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > Deprecated in wp-content/plugins/sn-rating/sn_rating.php+296
    Function create_function() is deprecated
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the sn_rating handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the sn_rating handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method RatingWidget::register_my_widget() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

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
Almost there! Just fix the following items
  • 5× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/sn-rating/rating_html.php:99
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/sn-rating/rating_html.php:99
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/sn-rating/widget.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/sn-rating/ajax-entity-rating.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sn-rating/ajax-rating.php:47

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > Javascript (severe) in unknown
    /wp-content/plugins/sn-rating/scripts/rating.js?ver=6.3.1 9:69 Uncaught TypeError: jQuery(...).live is not a function
    • > GET request to /wp-admin/options-general.php?page=rating_options
    • > Javascript (severe) in unknown
    /wp-content/plugins/sn-rating/scripts/admin-rating.js?ver=6.3.1 30:29 Uncaught TypeError: jQuery(...).live is not a function

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that need to be fixed:
  • Screenshots: These screenshots require images: #17 (BuddyPressMedia - Detail View), #18 (BuddyPressMedia - Popup View), #19 (BuddyPressMedia - Activity View)
  • Donate link: Please fix this invalid URI: ""
The official readme.txt might help

sn-rating/sn_rating.php 92% from 13 tests

Analyzing the main PHP file in "SN Rating" version 1.4.7
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("sn-rating.php" instead of "sn_rating.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
Everything looks great! No dangerous files found in this plugin8,765 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP143745657,033
CSS381531,530
JavaScript2149114
HTML13088

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity30.50
▷ Minimum class complexity1.00
▷ Maximum class complexity118.00
Average method complexity6.13
▷ Minimum method complexity1.00
▷ Maximum method complexity41.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods46
▷ Static methods12.17%
▷ Public methods4393.48%
▷ Protected methods00.00%
▷ Private methods36.52%
Functions16
▷ Named functions16100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
68 PNG files occupy 0.87MB with 0.39MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-8.png10.93KB5.80KB▼ 46.95%
screenshots/demographic-step-1.png36.44KB14.17KB▼ 61.10%
screenshots/assign_rating.png41.66KB14.44KB▼ 65.35%
images/black-dot.png0.34KB0.37KB0.00%
screenshot-7.png12.38KB6.38KB▼ 48.47%