84% wphobby-ajax-search-for-woocommerce

Code Review | WPHobby Ajax Search for WooCommerce

WordPress plugin WPHobby Ajax Search for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: wphobby-ajax-sear...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.2.3
  • WordPress version: 6.3.1
  • First release: Sep 24, 2019
  • Latest release: Dec 13, 2019
  • Number of updates: 5
  • Update frequency: every 91.0 days
  • Top authors: darell (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /541 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

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

Server-side resources used by WPHobby Ajax Search for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.94 ▲0.62
Dashboard /wp-admin3.31 ▲0.0144.84 ▼2.47
Posts /wp-admin/edit.php3.36 ▲0.0146.52 ▲8.15
Add New Post /wp-admin/post-new.php5.89 ▲0.0180.19 ▼18.29
Media Library /wp-admin/upload.php3.23 ▲0.0133.52 ▲1.66

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 41 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

WPHobby Ajax Search for WooCommerce: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲6013.26 ▼0.911.71 ▲0.0939.38 ▼1.70
Dashboard /wp-admin2,212 ▲215.87 ▲0.9793.53 ▼26.3638.62 ▼8.22
Posts /wp-admin/edit.php2,092 ▲32.06 ▲0.0739.76 ▲1.9436.03 ▲4.45
Add New Post /wp-admin/post-new.php1,520 ▼2217.73 ▼0.57637.00 ▼29.2145.00 ▼10.03
Media Library /wp-admin/upload.php1,394 ▲124.29 ▲0.0995.46 ▲0.7945.13 ▲4.04

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 does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
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
  • 12× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/help/tab-help.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/general/tab-advanced.php:12
    • > PHP Warning
      require(WHWAS_DIRchanges.txt): failed to open stream: No such file or directory in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/help/tab-change-log.php on line 12
    • > PHP Warning
      Use of undefined constant WHWAS_DIR - assumed 'WHWAS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/help/tab-change-log.php on line 12
    • > PHP Fatal error
      require(): Failed opening required 'WHWAS_DIRchanges.txt' (include_path='.:/usr/share/php') in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/help/tab-change-log.php on line 12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/whwas_admin.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/general/tab-custom-style.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/whwas_widget.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/general/top.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/wphobby-ajax-search-for-woocommerce/includes/admin/sections/general/tab-general.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
8 plugin tags: woocommerce search by sku, woocommerce search results, woocommerce search form, ajax search, woocommerce...

wphobby-ajax-search-for-woocommerce/wphobby-woo-ajax-search.php 92% from 13 tests

"WPHobby Ajax Search for WooCommerce" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
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 ("wphobby-ajax-search-for-woocommerce.php" instead of "wphobby-woo-ajax-search.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin5,905 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
CSS81,942524,660
PHP14160171682
JavaScript21524385
SVG213178

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.26
Average class complexity11.20
▷ Minimum class complexity2.00
▷ Maximum class complexity27.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods34
▷ Static methods12.94%
▷ Public methods34100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.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
4 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/admin/images/icon.png19.99KB0.88KB▼ 95.61%
assets/images/play-button.png13.39KB10.70KB▼ 20.12%
assets/images/file.png5.09KB3.92KB▼ 22.99%
assets/images/mail.png16.25KB13.04KB▼ 19.74%