83% hide-add-cart-if-already-purchased

Code Review | Hide Add Cart If Already Purchased - WooCommerce

WordPress plugin Hide Add Cart If Already Purchased - WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: hide-add-cart-if-...
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.8
  • WordPress version: 6.3.1
  • First release: Aug 19, 2021
  • Latest release: Aug 19, 2021
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: largbasket (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /321 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼7.24ms] Passed 4 tests

This is a short check of server-side resources used by Hide Add Cart If Already Purchased - WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0236.71 ▼1.07
Dashboard /wp-admin3.31 ▲0.0146.36 ▼1.22
Posts /wp-admin/edit.php3.37 ▲0.0143.08 ▼6.64
Add New Post /wp-admin/post-new.php5.91 ▲0.0380.50 ▼20.04
Media Library /wp-admin/upload.php3.24 ▲0.0134.78 ▲3.75

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 22 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Hide Add Cart If Already Purchased - WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,912 ▲17714.06 ▼0.237.77 ▲6.1037.30 ▼7.03
Dashboard /wp-admin2,213 ▲254.87 ▼0.0296.62 ▼16.5839.91 ▼1.75
Posts /wp-admin/edit.php2,093 ▲42.00 ▲0.0034.58 ▼6.1032.78 ▼0.91
Add New Post /wp-admin/post-new.php1,518 ▼1623.15 ▼0.03653.75 ▼4.3553.82 ▲0.66
Media Library /wp-admin/upload.php1,395 ▲74.16 ▼0.03100.04 ▲4.0542.37 ▼1.29

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means 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 take a closer look at the following
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/hide-add-cart-if-already-purchased/admin/partials/hcap-admin-display.php
    • > /wp-content/plugins/hide-add-cart-if-already-purchased/public/partials/hcap-public-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

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
Attributes that need to be fixed:
  • Donate link: Please fix this invalid URI: "wprashed.com"
  • Screenshots: These screenshots require images: #1 (Setting Page), #2 (Product Archive Page), #3 (Single Product Page)
The official readme.txt is a good inspiration

hide-add-cart-if-already-purchased/hcap.php 85% from 13 tests

The principal PHP file in "Hide Add Cart If Already Purchased - WooCommerce" v. 1.0.0 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("hide-add-cart-if-already-purchased.php" instead of "hcap.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected179 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP12120527173
JavaScript24546
CSS2080

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.09
Average class complexity1.43
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.13
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods23
▷ Static methods28.70%
▷ Public methods1878.26%
▷ Protected methods00.00%
▷ Private methods521.74%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There were not PNG files found in your plugin