84% ot-product-price-filter

Code Review | Product Price Filter

WordPress plugin Product Price Filter scored84%from 54 tests.

About plugin

  • Plugin page: ot-product-price-...
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9.5
  • WordPress version: 6.3.1
  • First release: Aug 29, 2017
  • Latest release: Apr 19, 2018
  • Number of updates: 8
  • Update frequency: every 29.1 days
  • Top authors: caselock (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,253 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

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

Server-side resources used by Product Price Filter
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0037.80 ▼1.94
Dashboard /wp-admin3.31 ▼0.0446.80 ▼14.92
Posts /wp-admin/edit.php3.36 ▲0.0050.28 ▲1.91
Add New Post /wp-admin/post-new.php5.89 ▲0.0094.53 ▲2.68
Media Library /wp-admin/upload.php3.23 ▲0.0035.65 ▼1.73

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 11 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Product Price Filter: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.24 ▼0.981.90 ▲0.2851.94 ▲11.19
Dashboard /wp-admin2,206 ▲185.86 ▲0.00105.26 ▲5.6841.50 ▼3.07
Posts /wp-admin/edit.php2,089 ▼02.05 ▲0.0040.26 ▲1.7434.95 ▲0.94
Add New Post /wp-admin/post-new.php1,542 ▲2318.15 ▼4.92615.35 ▼72.7156.77 ▲8.64
Media Library /wp-admin/upload.php1,388 ▼04.20 ▲0.0694.83 ▼3.5441.03 ▼3.10

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/ot-product-price-filter/otproductpricefilter-widget.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function otpf_e() in wp-content/plugins/ot-product-price-filter/otproductpricefilter-options.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
9 plugin tags: woocommerce products filter, widget, products filter, filter for woocommerce, woocommerce product filter...

ot-product-price-filter/otproductpricefilter.php 92% from 13 tests

The main PHP script in "Product Price Filter" version 1.2.1 is automatically included on every request by WordPress
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("ot-product-price-filter.php" instead of "otproductpricefilter.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin1,912 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript25423271,390
CSS3034280
PHP33818242

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity18.00
▷ Minimum class complexity3.00
▷ Maximum class complexity33.00
Average method complexity5.25
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods787.50%
▷ Protected methods112.50%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/slider-min.png3.15KB0.36KB▼ 88.54%
images/slider-max.png3.17KB0.36KB▼ 88.62%