84% jws-discount-display-for-woocommerce

Code Review | JWS Discount Display for WooCommerce

WordPress plugin JWS Discount Display for WooCommerce scored 84% from 54 tests.

About plugin

  • Plugin page: jws-discount-disp...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-4.8
  • WordPress version: 6.3.1
  • First release: Apr 1, 2018
  • Latest release: Apr 2, 2018
  • Number of updates: 3
  • Update frequency: every 4.7 days
  • Top authors: jasonsaunders35 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 651 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼7.92ms] Passed 4 tests

Server-side resources used by JWS Discount Display for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.64 ▼7.98
Dashboard /wp-admin3.31 ▲0.0145.27 ▼5.79
Posts /wp-admin/edit.php3.36 ▲0.0049.02 ▲2.34
Add New Post /wp-admin/post-new.php5.89 ▲0.0184.11 ▼17.68
Media Library /wp-admin/upload.php3.23 ▲0.0036.07 ▼0.24

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 16 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

JWS Discount Display for WooCommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.53 ▼0.901.62 ▼0.3137.06 ▼5.53
Dashboard /wp-admin2,203 ▲155.84 ▲0.9696.35 ▼20.7440.31 ▼8.16
Posts /wp-admin/edit.php2,089 ▼02.05 ▲0.0433.42 ▼5.0235.36 ▼0.04
Add New Post /wp-admin/post-new.php1,533 ▼923.10 ▲4.67656.50 ▲39.2155.76 ▼12.77
Media Library /wp-admin/upload.php1,388 ▲64.24 ▲0.0794.04 ▼3.8142.36 ▼3.76

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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
Please fix the following
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function jws_dd_getConfigurationOptions() in wp-content/plugins/jws-discount-display-for-woocommerce/backend/helper.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jws-discount-display-for-woocommerce/backend/form.php:54
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/jws-discount-display-for-woocommerce/discount-display.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jws-discount-display-for-woocommerce/frontend/setup.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jws-discount-display-for-woocommerce/backend/validation.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jws-discount-display-for-woocommerce/backend/admin.php:3

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: Add images for these screenshots: #1 (Backend configuration options), #2 (Frontend examples of display options), #3 (Example of optional result in product detail section)
The official readme.txt is a good inspiration

jws-discount-display-for-woocommerce/discount-display.php 92% from 13 tests

The entry point to "JWS Discount Display for WooCommerce" version 1.0.0 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("jws-discount-display-for-woocommerce.php" instead of "discount-display.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected841 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP87451378
CSS24321238
JavaScript23541225

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions12
▷ Named functions12100.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
3 PNG files occupy 0.28MB with 0.18MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-2.png73.21KB20.14KB▼ 72.48%
assets/screenshot-3.png97.89KB37.79KB▼ 61.40%
assets/screenshot-1.png112.85KB40.35KB▼ 64.25%