83% ns-product-rating-for-woocommerce

Code Review | NS Product Rating for WooCommerce

WordPress plugin NS Product Rating for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: ns-product-rating...
  • Plugin version: 1.2.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.1
  • WordPress version: 6.3.1
  • First release: Sep 3, 2016
  • Latest release: Mar 24, 2023
  • Number of updates: 51
  • Update frequency: every 46.9 days
  • Top authors: nsthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /6,034 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 gracefully, with no errors

Server metrics [RAM: ▲0.05MB] [CPU: ▼7.78ms] Passed 4 tests

This is a short check of server-side resources used by NS Product Rating for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0638.71 ▼7.62
Dashboard /wp-admin3.37 ▲0.0351.17 ▼12.86
Posts /wp-admin/edit.php3.48 ▲0.1351.97 ▼2.45
Add New Post /wp-admin/post-new.php5.95 ▲0.0790.45 ▼8.18
Media Library /wp-admin/upload.php3.29 ▲0.0640.58 ▲6.33
/wp-admin/admin.php?page=plugineye1653.2639.58

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 43 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for NS Product Rating for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,791 ▲3014.30 ▼0.051.93 ▼0.0641.55 ▼6.17
Dashboard /wp-admin2,200 ▲295.66 ▲0.1384.09 ▼11.2349.54 ▲1.16
Posts /wp-admin/edit.php2,105 ▲82.02 ▼0.0241.68 ▲0.7236.07 ▼3.62
Add New Post /wp-admin/post-new.php1,545 ▲523.30 ▲4.76661.84 ▼0.4157.65 ▼1.11
Media Library /wp-admin/upload.php1,402 ▼14.27 ▲0.06106.05 ▲1.1543.99 ▼2.19
/wp-admin/admin.php?page=plugineye1658872.0329.8331.50

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 20× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.shop.php on line 3
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.plugin.php:17
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.shop.php on line 3
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.shop.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.template.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.admin.php:3
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.shop.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.form.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.restable.php:3

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 90% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: You are using too many tags: 11 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (View Rating on shop page.), #2 (View Rating on single product.), #3 (View Rating results.)
You can take inspiration from this readme.txt

ns-product-rating-for-woocommerce/ns_product_rating_woocommerce.plugin.php 92% from 13 tests

This is the main PHP file of "NS Product Rating for WooCommerce" version 1.2.5, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("ns-product-rating-for-woocommerce.php" instead of "ns_product_rating_woocommerce.plugin.php")

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
No dangerous file extensions were detected1,862 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
PHP16155281940
CSS48012638
JavaScript55414189
PO File1407095

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity11.00
▷ Minimum class complexity3.00
▷ Maximum class complexity20.00
Average method complexity2.04
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods31
▷ Static methods00.00%
▷ Public methods1754.84%
▷ Protected methods00.00%
▷ Private methods1445.16%
Functions25
▷ Named functions1560.00%
▷ Anonymous functions1040.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
9 PNG files occupy 0.14MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
ns-admin-options/img/ns-theme-promo.png29.37KB8.96KB▼ 69.50%
asset/img/woo-watermark-bannerino.png9.87KB4.09KB▼ 58.56%
ns-admin-options/img/placeholder.png2.75KB2.92KB0.00%
asset/img/woo-watermark-bennerone.png38.25KB14.47KB▼ 62.16%
asset/img/banneriiino.png9.07KB3.93KB▼ 56.70%