68% sort-by-recent-views-for-woocommerce

Code Review | Sort By Recent Views For WooCommerce

WordPress plugin Sort By Recent Views For WooCommerce scored68%from 54 tests.

About plugin

  • Plugin page: sort-by-recent-vi...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.6
  • WordPress version: 6.3.1
  • First release: Dec 14, 2020
  • Latest release: Dec 14, 2020
  • Number of updates: 3
  • Update frequency: every 0.7 days
  • Top authors: j2fb (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /342 total downloads

Benchmarks

Plugin footprint 65% 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.00MB] [CPU: ▼4.67ms] Passed 4 tests

An overview of server-side resources used by Sort By Recent Views For WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0041.06 ▼0.60
Dashboard /wp-admin3.31 ▲0.0047.11 ▼6.47
Posts /wp-admin/edit.php3.36 ▲0.0046.19 ▼2.88
Add New Post /wp-admin/post-new.php5.89 ▲0.0085.51 ▼7.37
Media Library /wp-admin/upload.php3.23 ▲0.0035.20 ▼1.95
Sort By Recent Views /wp-admin/admin.php?page=sort-by-recent-views-for-woocommerce3.0023.49

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 6 new files
Database: 1 new table, 10 new options
New tables
wp_wsrv_views
New WordPress options
wsrv_enable_automatic_maintenance
can_compress_scripts
wsrv_enable_sorting
wsrv_timeframe
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
wsrv_custom_sorting_option_name
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Sort By Recent Views For WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.26 ▼1.381.74 ▲0.0843.48 ▼2.66
Dashboard /wp-admin2,206 ▲155.85 ▲0.9796.65 ▼9.8743.87 ▲2.21
Posts /wp-admin/edit.php2,089 ▼02.01 ▼0.0536.00 ▼1.5339.27 ▲5.26
Add New Post /wp-admin/post-new.php1,538 ▲1023.49 ▲0.48686.81 ▲29.6153.88 ▼4.24
Media Library /wp-admin/upload.php1,391 ▲64.21 ▲0.0499.21 ▼7.2642.26 ▼5.44
Sort By Recent Views /wp-admin/admin.php?page=sort-by-recent-views-for-woocommerce280.440.095.39

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_wsrv_views
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • widget_recent-comments
    • wsrv_enable_automatic_maintenance
    • wsrv_enable_sorting
    • wsrv_timeframe
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • wsrv_custom_sorting_option_name
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/sort-by-recent-views-for-woocommerce/includes/wsrv-logic.php:50
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sort-by-recent-views-for-woocommerce/includes/wsrv-activation.php:41

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=sort-by-recent-views-for-woocommerce
    • > Network (severe)
    wp-admin/admin.php?page=sort-by-recent-views-for-woocommerce - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

sort-by-recent-views-for-woocommerce/sort-by-recent-views-for-woocommerce.php Passed 13 tests

"Sort By Recent Views For WooCommerce" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
60 characters long description:
Adds the "sort by recent views" sorting option to your shop.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected297 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP410276279
JavaScript11518

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin