93% woocommerce-natural-sort-for-products

Code Review | Woocommerce Natural Sort

WordPress plugin Woocommerce Natural Sort scored 93% from 54 tests.

About plugin

  • Plugin page: woocommerce-natur...
  • Plugin version: 0.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.9
  • WordPress version: 5.8.1
  • First release: Dec 20, 2012
  • Latest release: Jul 8, 2016
  • Number of updates: 13
  • Update frequency: every 99.7 days
  • Top authors: swicks (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,723 total downloads

Benchmarks

Plugin footprint Passed 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.02MB] [CPU: ▼143.40ms] Passed 4 tests

This is a short check of server-side resources used by Woocommerce Natural Sort
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.0236.79 ▲1.81
Dashboard /wp-admin3.08 ▲0.0344.79 ▼4.81
Posts /wp-admin/edit.php3.13 ▲0.0244.00 ▲3.71
Add New Post /wp-admin/post-new.php5.44 ▲0.0094.23 ▼569.00
Media Library /wp-admin/upload.php3.02 ▲0.0232.59 ▼1.59

Server storage [IO: ▲0.11MB] [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: 6 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Woocommerce Natural Sort
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,678 ▲8315.88 ▲0.367.35 ▼2.4752.28 ▼2.69
Dashboard /wp-admin2,967 ▲335.90 ▼0.28135.82 ▼17.94119.36 ▼7.11
Posts /wp-admin/edit.php2,736 ▼32.70 ▲0.0166.65 ▼1.2097.82 ▲2.32
Add New Post /wp-admin/post-new.php1,672 ▲6818.78 ▼0.09379.92 ▼4.89106.31 ▼14.43
Media Library /wp-admin/upload.php1,804 ▲565.02 ▼0.00147.57 ▼8.36128.72 ▲7.00

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means 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
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/woocommerce-natural-sort-for-products/ds-naturalsort.php:34

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === woocommerce-natural-sort-for-products === )
  • Screenshots: Please add images for these screenshots: #1 (Before Plugin Activation), #2 (After Plugin Activation)
You can take inspiration from this readme.txt

woocommerce-natural-sort-for-products/ds-naturalsort.php 85% from 13 tests

"Woocommerce Natural Sort" version 0.0.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: Name the main plugin file the same as the plugin slug ("woocommerce-natural-sort-for-products.php" instead of "ds-naturalsort.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin219 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP15743185
PO File182034

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity17.00
▷ Minimum class complexity17.00
▷ Maximum class complexity17.00
Average method complexity3.29
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods685.71%
▷ Protected methods00.00%
▷ Private methods114.29%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.09MB with 0.06MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png48.76KB20.12KB▼ 58.74%
screenshot-2.png46.04KB18.28KB▼ 60.30%