83% custom-availability-for-woocommerce

Code Review | WooCommerce Custom Availability

WordPress plugin WooCommerce Custom Availability scored83%from 54 tests.

About plugin

  • Plugin page: custom-availabili...
  • Plugin version: 1.2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3.1-4.8.2
  • WordPress version: 6.3.1
  • First release: Jul 13, 2016
  • Latest release: Nov 2, 2017
  • Number of updates: 15
  • Update frequency: every 31.8 days
  • Top authors: Zuige (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

400+ active /4,873 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼3.05ms] Passed 4 tests

A check of server-side resources used by WooCommerce Custom Availability
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0838.50 ▼4.10
Dashboard /wp-admin3.38 ▲0.0747.24 ▼7.12
Posts /wp-admin/edit.php3.49 ▲0.1345.93 ▼1.89
Add New Post /wp-admin/post-new.php5.96 ▲0.0785.81 ▲0.90
Media Library /wp-admin/upload.php3.30 ▲0.0736.72 ▲3.30

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce Custom Availability
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.74 ▲0.361.78 ▲0.1049.02 ▲1.97
Dashboard /wp-admin2,206 ▲185.84 ▼0.04111.86 ▼3.5642.74 ▼2.88
Posts /wp-admin/edit.php2,089 ▼02.03 ▼0.0233.78 ▼5.9433.65 ▼0.10
Add New Post /wp-admin/post-new.php1,533 ▲1923.13 ▲5.51582.97 ▼117.4851.66 ▼6.39
Media Library /wp-admin/upload.php1,391 ▲94.20 ▼0.1198.63 ▼7.2640.49 ▼5.45

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 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget

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
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/custom-availability-for-woocommerce/includes/class-woocommerce-custom-availability-tab.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
3 plugin tags: woocommerce, availability, custom

custom-availability-for-woocommerce/woocommerce-custom-availability.php 85% from 13 tests

This is the main PHP file of "WooCommerce Custom Availability" version 1.2.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("custom-availability-for-woocommerce.php" instead of "woocommerce-custom-availability.php")
  • 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

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
There were no executable files found in this plugin774 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP11131268648
XML1315051
PO File171033
Markdown114028
JSON20014

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity12.43
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.67
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods49
▷ Static methods48.16%
▷ Public methods4795.92%
▷ Protected methods00.00%
▷ Private methods24.08%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
7 PNG files occupy 0.56MB with 0.33MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png147.85KB44.76KB▼ 69.73%
assets/icon-512x512.png29.00KB15.20KB▼ 47.60%
assets/screenshot-2.png228.78KB64.68KB▼ 71.73%
assets/banner-772x250.png36.80KB17.21KB▼ 53.22%
assets/banner-1544x500.png65.53KB27.59KB▼ 57.89%