84% restrict-purchase-with-category

Code Review | Category Restriction WooCommerce

WordPress plugin Category Restriction WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: restrict-purchase...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-4.5.2
  • WordPress version: 6.3.1
  • First release: Mar 23, 2017
  • Latest release: Mar 23, 2017
  • Number of updates: 13
  • Update frequency: every 0.1 days
  • Top authors: themelocation (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /971 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.03MB] [CPU: ▼3.76ms] Passed 4 tests

This is a short check of server-side resources used by Category Restriction WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0340.52 ▲1.38
Dashboard /wp-admin3.33 ▲0.0349.95 ▼4.46
Posts /wp-admin/edit.php3.39 ▲0.0347.26 ▼1.14
Add New Post /wp-admin/post-new.php5.92 ▲0.0383.65 ▼10.12
Media Library /wp-admin/upload.php3.26 ▲0.0339.33 ▲0.69

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 7 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Category Restriction WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.24 ▼0.111.80 ▼0.2044.35 ▲2.85
Dashboard /wp-admin2,195 ▲185.62 ▼0.0392.25 ▼0.6941.19 ▲0.19
Posts /wp-admin/edit.php2,097 ▼31.94 ▼0.0736.24 ▼0.1533.80 ▼3.31
Add New Post /wp-admin/post-new.php1,537 ▲1118.48 ▼4.99618.95 ▼40.1768.52 ▲16.72
Media Library /wp-admin/upload.php1,400 ▼04.16 ▼0.0298.74 ▼15.5845.24 ▼2.74

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options

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 everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/restrict-purchase-with-category/category_restriction_woocommerce.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
Attributes that need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Dashboard page for settings), #2 (Dashboard page for editing a message to display on product pages), #3 (Thats how message look on shop / products page), #4 (Thats how message look on product page)
The official readme.txt is a good inspiration

restrict-purchase-with-category/category_restriction_woocommerce.php 92% from 13 tests

The primary PHP file in "Category Restriction WooCommerce" version 1.0 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("restrict-purchase-with-category.php" instead of "category_restriction_woocommerce.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin273 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP111018249
JavaScript15124

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.25
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%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.26MB with 0.16MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png71.31KB29.02KB▼ 59.30%
screenshot-2.png54.21KB21.25KB▼ 60.81%
screenshot-4.png69.00KB24.63KB▼ 64.30%
screenshot-3.png73.26KB25.74KB▼ 64.86%