83% codja-wc-ajax-search

Code Review | WooCommerce Ajax Search

WordPress plugin WooCommerce Ajax Search scored 83% from 54 tests.

About plugin

  • Plugin page: codja-wc-ajax-search
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-4.9.1
  • WordPress version: 6.3.1
  • First release: Oct 26, 2017
  • Latest release: Dec 28, 2017
  • Number of updates: 10
  • Update frequency: every 6.4 days
  • Top authors: codja (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

10+ active / 1,323 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼3.86ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Ajax Search
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0838.71 ▼1.89
Dashboard /wp-admin3.38 ▲0.0845.20 ▼5.54
Posts /wp-admin/edit.php3.50 ▲0.1442.26 ▼4.10
Add New Post /wp-admin/post-new.php5.97 ▲0.0886.91 ▼3.91
Media Library /wp-admin/upload.php3.31 ▲0.0836.28 ▲4.37

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 19 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce Ajax Search
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.44 ▲0.081.82 ▲0.0443.30 ▼0.15
Dashboard /wp-admin2,206 ▲245.91 ▲1.05117.34 ▲13.9141.61 ▼0.76
Posts /wp-admin/edit.php2,089 ▼02.03 ▲0.0234.33 ▲0.5033.19 ▼0.77
Add New Post /wp-admin/post-new.php1,534 ▼022.85 ▼0.33613.65 ▼67.7956.94 ▼10.67
Media Library /wp-admin/upload.php1,391 ▲34.19 ▼0.0497.34 ▼0.3641.14 ▼2.09

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 8× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Notice
      Undefined variable: product in wp-content/plugins/codja-wc-ajax-search/templates/product.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/codja-wc-ajax-search/templates/admin/settings_page.php:6
    • > PHP Warning
      Use of undefined constant CJ_WC_AJAX_SEARCH_URL - assumed 'CJ_WC_AJAX_SEARCH_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/codja-wc-ajax-search/templates/admin/settings_page.php on line 3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/codja-wc-ajax-search/templates/remove_button.php:2
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/codja-wc-ajax-search/templates/product.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_permalink() in wp-content/plugins/codja-wc-ajax-search/templates/product.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/codja-wc-ajax-search/templates/no_products.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/codja-wc-ajax-search/templates/add_button.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 87% from 29 tests

readme.txt 88% 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
These attributes need your attention:
  • Requires php: Version format is invalid
  • Tags: Too many tags (50 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

codja-wc-ajax-search/cj-wc-ajax-search.php 85% from 13 tests

The primary PHP file in "WooCommerce Ajax Search" version 1.0.0 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("codja-wc-ajax-search.php" instead of "cj-wc-ajax-search.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

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,090 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP612096494
CSS3550321
JavaScript2445196
PO File1303179

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity65.00
▷ Minimum class complexity65.00
▷ Maximum class complexity65.00
Average method complexity3.46
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods26
▷ Static methods415.38%
▷ Public methods1453.85%
▷ Protected methods00.00%
▷ Private methods1246.15%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/search.png0.81KB0.56KB▼ 30.75%
public/images/plugin_image.png29.42KB9.18KB▼ 68.78%