84% preferabli-for-woocommerce

Code Review | Preferabli for WooCommerce

WordPress plugin Preferabli for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: preferabli-for-wo...
  • Plugin version: 2.7
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.1
  • WordPress version: 6.3.1
  • First release: Dec 19, 2022
  • Latest release: Jan 4, 2023
  • Number of updates: 5
  • Update frequency: every 3.8 days
  • Top authors: preferabli (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /204 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.20MB] [CPU: ▼4.38ms] Passed 4 tests

Server-side resources used by Preferabli for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1537.70 ▼5.97
Dashboard /wp-admin3.52 ▲0.2244.64 ▼5.65
Posts /wp-admin/edit.php3.63 ▲0.2749.71 ▲1.81
Add New Post /wp-admin/post-new.php6.13 ▲0.2482.18 ▼7.69
Media Library /wp-admin/upload.php3.40 ▲0.1737.94 ▲4.76

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 8 new options
New WordPress options
can_compress_scripts
p4wc_plugin_options
widget_theysaidso_widget
widget_recent-posts
p4wc_db_version
theysaidso_admin_options
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Preferabli for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲8913.33 ▼1.421.60 ▼0.4140.21 ▼6.72
Dashboard /wp-admin2,241 ▲535.21 ▲0.33114.17 ▲12.3543.53 ▲2.54
Posts /wp-admin/edit.php2,129 ▲402.44 ▲0.4041.97 ▲7.8336.07 ▲2.73
Add New Post /wp-admin/post-new.php1,541 ▲1123.38 ▲0.16682.91 ▲10.3736.57 ▼31.54
Media Library /wp-admin/upload.php1,423 ▲384.38 ▲0.2293.82 ▼9.8240.42 ▼3.04

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • p4wc_db_version

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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
Please fix the following items
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_plugin_active() in wp-content/plugins/preferabli-for-woocommerce/templates/admin.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/preferabli-for-woocommerce/inc/preferabli-label-post-type.php:36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/preferabli-for-woocommerce/inc/admin.php:29

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: beer, woocommerce, spirits, wine

preferabli-for-woocommerce/preferabli-for-woocommerce.php Passed 13 tests

The main PHP file in "Preferabli for WooCommerce" ver. 2.7 adds more information about the plugin and also serves as the entry point for this plugin
63 characters long description:
Integrate Preferabli functionality into your WooCommerce store.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected1,178 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP112241511,170
JavaScript1417
SVG1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity18.14
▷ Minimum class complexity1.00
▷ Maximum class complexity46.00
Average method complexity5.44
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods27
▷ Static methods725.93%
▷ Public methods2177.78%
▷ Protected methods00.00%
▷ Private methods622.22%
Functions32
▷ Named functions3093.75%
▷ Anonymous functions26.25%
Constants2
▷ Global constants2100.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