78% custom-ratings

Code Review | Custom Ratings

WordPress plugin Custom Ratings scored 78% from 54 tests.

About plugin

  • Plugin page: custom-ratings
  • Plugin version: 1.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.3.1
  • WordPress version: 5.8.1
  • First release: Mar 8, 2016
  • Latest release: Dec 16, 2019
  • Number of updates: 84
  • Update frequency: every 16.7 days
  • Top authors: stevepuddick (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active / 4,552 total downloads

Benchmarks

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

This is a short check of server-side resources used by Custom Ratings
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.18 ▲0.3551.73 ▲19.01
Dashboard /wp-admin3.44 ▲0.3948.54 ▲3.85
Posts /wp-admin/edit.php3.50 ▲0.3945.56 ▲0.85
Add New Post /wp-admin/post-new.php5.75 ▲0.3194.08 ▼550.64
Media Library /wp-admin/upload.php3.32 ▲0.3235.88 ▲4.95
Custom Ratings /wp-admin/options-general.php?page=custom-ratings-options-page3.3241.86

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 51 new files
Database: no new tables, 14 new options
New WordPress options
wpcr_first_vote_text
wpcr_plugin_version
wpcr_excerpt_output_type
wpcr_error_text
wpcr_loading_text
wpcr_report_text
wpcr_intro_text
wpcr_content_output_type
wpcr_only_in_loop
wpcr_post_types
...

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Ratings
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,987 ▲39117.57 ▲1.9444.65 ▲33.4347.57 ▼3.86
Dashboard /wp-admin2,982 ▲486.01 ▲0.05141.13 ▼23.74109.21 ▲0.62
Posts /wp-admin/edit.php2,792 ▲532.70 ▲0.0063.96 ▼1.9888.43 ▼3.31
Add New Post /wp-admin/post-new.php1,617 ▼6618.47 ▼0.27369.74 ▼21.64116.88 ▲11.71
Media Library /wp-admin/upload.php1,760 ▼475.04 ▲0.03163.23 ▲17.09113.64 ▲0.90
Custom Ratings /wp-admin/options-general.php?page=custom-ratings-options-page2,2974.33111.34118.87

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 14 options in the database
    • wpcr_only_in_loop
    • wpcr_only_on_main_query
    • wpcr_first_vote_text
    • wpcr_star_type
    • wpcr_content_output_type
    • wpcr_adding_vote_text
    • wpcr_error_text
    • wpcr_excerpt_output_type
    • wpcr_report_text
    • wpcr_thank_you_text
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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 items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/custom-ratings/public/partials/custom-ratings-excerpt-public-display.php
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/custom-ratings/includes/custom-ratings-post-data.php:27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/custom-ratings/admin/partials/custom-ratings-post-admin-display.php:36
    • > PHP Warning
      Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-ratings/includes/set-decimal.php on line 37
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/custom-ratings/includes/custom-ratings-post-data.php on line 24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/custom-ratings/public/partials/custom-ratings-public-ractive-template.php:8
    • > PHP Notice
      Undefined variable: star_type in wp-content/plugins/custom-ratings/public/partials/custom-ratings-public-ractive-template.php on line 6
    • > PHP Notice
      Undefined variable: star_img_url in wp-content/plugins/custom-ratings/public/partials/custom-ratings-public-ractive-template.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/custom-ratings/public/custom-ratings-display-variables-and-checks.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% 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
These attributes need your attention:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === custom-ratings === )
You can take inspiration from this readme.txt

custom-ratings/custom-ratings.php Passed 13 tests

The principal PHP file in "Custom Ratings" v. 1.5.1 is loaded by WordPress automatically on each request
123 characters long description:
Rate post, pages, custom post types, and more! Upload your own rating object (cat, cupcake, wine glass, whatever you want!)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin16,943 lines of code in 33 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript74,2051,42514,074
PHP174117511,431
CSS410442976
Sass36611380
JSON20082

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity15.14
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods72
▷ Static methods79.72%
▷ Public methods6793.06%
▷ Protected methods00.00%
▷ Private methods56.94%
Functions7
▷ Named functions342.86%
▷ Anonymous functions457.14%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
5 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/star.png8.05KB4.47KB▼ 44.51%
public/images/cash.png19.91KB10.34KB▼ 48.05%
public/images/heart.png10.08KB6.34KB▼ 37.09%
public/images/carrot.png9.41KB5.20KB▼ 44.69%
public/images/wine-glass.png16.08KB6.97KB▼ 56.64%