73% distancr

Code Review | Distancr - Price by Location for WooCommerce

WordPress plugin Distancr - Price by Location for WooCommerce scored 73% from 54 tests.

About plugin

  • Plugin page: distancr
  • Plugin version: 1.1.8
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9
  • WordPress version: 5.9.2
  • First release: Oct 6, 2020
  • Latest release: Mar 10, 2022
  • Number of updates: 16
  • Update frequency: every 32.5 days
  • Top authors: patrickposner (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

10+ active / 478 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲4.39MB] [CPU: ▼279.01ms] 75% from 4 tests

An overview of server-side resources used by Distancr - Price by Location for WooCommerce
Please have a look at the following items
  • CPU: Total CPU usage must kept under 500.00ms (currently 1,837.08ms on /wp-admin/admin.php?page=distancr)
PageMemory (MB)CPU Time (ms)
Home /8.29 ▲4.7879.16 ▲31.41
Dashboard /wp-admin8.31 ▲4.9163.69 ▲30.60
Posts /wp-admin/edit.php8.31 ▲4.6757.85 ▲15.72
Add New Post /wp-admin/post-new.php10.19 ▲3.22114.19 ▼1,185.31
Media Library /wp-admin/upload.php8.31 ▲5.0248.14 ▲22.95
Distancr /wp-admin/admin.php?page=distancr8.311,837.08
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.3144.72

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 191 new files
Database: no new tables, 4 new options
New WordPress options
fs_active_plugins
fs_accounts
fs_gdpr
fs_debug_mode

Browser metrics Passed 4 tests

Distancr - Price by Location for WooCommerce: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,909 ▲15516.75 ▲0.7012.76 ▲6.372.34 ▼0.51
Dashboard /wp-admin2,926 ▲656.14 ▼0.02119.82 ▼16.72174.75 ▲9.16
Posts /wp-admin/edit.php2,722 ▲313.25 ▲0.0063.48 ▼1.49155.46 ▲14.31
Add New Post /wp-admin/post-new.php1,698 ▼1921.46 ▼0.22474.09 ▲25.90165.15 ▲3.90
Media Library /wp-admin/upload.php1,726 ▲285.52 ▲0.02142.25 ▼1.72206.67 ▲18.97
Distancr /wp-admin/admin.php?page=distancr1,2562.4655.58166.80
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,4332.4955.53114.06

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/distancr/inc/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 4 options
    • fs_accounts
    • fs_debug_mode
    • fs_active_plugins
    • fs_gdpr

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/distancr/distancr.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Screenshots: Add descriptions for screenshots #4, #5 in distancr/assets to your readme.txt
The official readme.txt might help

distancr/distancr.php 92% from 13 tests

The primary PHP file in "Distancr - Price by Location for WooCommerce" version 1.1.8 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("4.6" instead of "4.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected33,060 lines of code in 147 files:
LanguageFilesBlank linesComment linesLines of code
PHP1147,36116,40831,757
JavaScript19144160711
CSS13311340
PO File197163252

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity84.26
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.65
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes50
▷ Abstract classes24.00%
▷ Concrete classes4896.00%
▷ Final classes00.00%
Methods1,173
▷ Static methods18415.69%
▷ Public methods83371.01%
▷ Protected methods151.28%
▷ Private methods32527.71%
Functions99
▷ Named functions99100.00%
▷ Anonymous functions00.00%
Constants125
▷ Global constants10080.00%
▷ Class constants2520.00%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
inc/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
inc/freemius/assets/img/distancr.png11.03KB2.89KB▼ 73.78%