74% simple-rating

Code Review | Simple Rating

WordPress plugin Simple Rating scored74%from 54 tests.

About plugin

  • Plugin page: simple-rating
  • Plugin version: 1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.9.4
  • WordPress version: 6.3.1
  • First release: Jan 25, 2014
  • Latest release: Mar 8, 2018
  • Number of updates: 57
  • Update frequency: every 27.4 days
  • Top authors: FlyerUA (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

700+ active /16,512 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.06MB] [CPU: ▼6.73ms] Passed 4 tests

Analyzing server-side resources used by Simple Rating
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.70 ▲0.2343.60 ▲1.23
Dashboard /wp-admin3.54 ▲0.2349.88 ▼1.85
Posts /wp-admin/edit.php3.65 ▲0.2948.67 ▼1.73
Add New Post /wp-admin/post-new.php5.43 ▼0.4667.83 ▼24.55
Media Library /wp-admin/upload.php3.46 ▲0.2338.48 ▲2.87
Simple Rating /wp-admin/options-general.php?page=spr_options3.5036.16

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 36 new files
Database: 2 new tables, 9 new options
New tables
wp_spr_votes
wp_spr_rating
New WordPress options
widget_spr_top_widget
can_compress_scripts
widget_recent-posts
widget_recent-comments
spr_settings
db_upgraded
widget_theysaidso_widget
spr_version
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Simple Rating
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.72 ▲0.222.15 ▲0.3043.91 ▼3.17
Dashboard /wp-admin2,199 ▲255.59 ▲0.0191.89 ▼9.9839.04 ▼4.48
Posts /wp-admin/edit.php2,104 ▲41.95 ▼0.0440.55 ▲4.8233.68 ▼0.84
Add New Post /wp-admin/post-new.php1,529 ▲123.07 ▲0.13647.47 ▼59.0753.83 ▲1.57
Media Library /wp-admin/upload.php1,401 ▲74.19 ▲0.0298.02 ▼9.5642.74 ▼4.55
Simple Rating /wp-admin/options-general.php?page=spr_options1,3172.2029.0835.08

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/simple-rating/uninstall.php+13
    rmdir(wp-content/plugins/simple-rating): Directory not empty
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

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
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function spr_save_settings() in wp-content/plugins/simple-rating/settings.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/simple-rating/spr_widgets.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/simple-rating/spr_widgets.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
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
8 plugin tags: star ratings, custom post type, vote, ratings, post rating...

simple-rating/rating.php 92% from 13 tests

"Simple Rating" version 1.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("simple-rating.php" instead of "rating.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin1,877 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP551241,543
JavaScript3160201
CSS200133

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity16.00
▷ Minimum class complexity16.00
▷ Maximum class complexity16.00
Average method complexity4.00
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions30
▷ Named functions30100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
21 PNG files occupy 0.10MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
resources/purple_bar.png3.14KB0.29KB▼ 90.66%
resources/red_bar.png3.11KB0.29KB▼ 90.57%
resources/green_bar.png3.12KB0.29KB▼ 90.62%
resources/red_circles.png4.89KB1.84KB▼ 62.32%
resources/purple_circles.png4.95KB1.82KB▼ 63.22%