84% razorpay-subscription-button

Code Review | Razorpay Subscription Button Plugin

WordPress plugin Razorpay Subscription Button Plugin scored84%from 54 tests.

About plugin

  • Plugin page: razorpay-subscrip...
  • Plugin version: 1.0.3
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Mar 31, 2021
  • Latest release: Jun 10, 2022
  • Number of updates: 10
  • Update frequency: every 44.3 days
  • Top authors: razorpay (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /868 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.14MB] [CPU: ▼4.56ms] Passed 4 tests

A check of server-side resources used by Razorpay Subscription Button Plugin
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0338.85 ▲4.04
Dashboard /wp-admin3.34 ▲0.0444.08 ▼5.21
Posts /wp-admin/edit.php3.45 ▲0.1047.06 ▲1.66
Add New Post /wp-admin/post-new.php5.23 ▼0.6566.96 ▼17.53
Media Library /wp-admin/upload.php3.26 ▲0.0436.97 ▲2.85
Razorpay Subscription Buttons /wp-admin/admin.php?page=rzp_subscription_button_view3.2132.50
Settings /wp-admin/admin.php?page=razorpay_subscription_settings3.2331.00
Razorpay Subscription Buttons /wp-admin/admin.php?page=razorpay_Subscription_button3.2132.31

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Razorpay Subscription Button Plugin
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,839 ▲7814.35 ▼0.021.92 ▲0.1939.61 ▼2.05
Dashboard /wp-admin2,217 ▲405.63 ▼0.0288.95 ▲1.0542.90 ▲4.99
Posts /wp-admin/edit.php2,122 ▲222.16 ▲0.1838.83 ▲1.6344.12 ▲6.57
Add New Post /wp-admin/post-new.php32 ▼1,4940.42 ▼23.300.08 ▼683.924.07 ▼51.55
Media Library /wp-admin/upload.php1,422 ▲194.15 ▼0.0195.10 ▼5.5972.76 ▲26.75
Razorpay Subscription Buttons /wp-admin/admin.php?page=rzp_subscription_button_view6961.126.7625.44
Settings /wp-admin/admin.php?page=razorpay_subscription_settings8982.1325.0429.99
Razorpay Subscription Buttons /wp-admin/admin.php?page=razorpay_Subscription_button7001.516.3123.60

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments

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
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 117× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Transport.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/razorpay-subscription-button/razorpay-subscription-buttons.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Requests_Exception_HTTP' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-1.7.0/library/Requests/Exception/HTTP/501.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/src/Collection.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Requests_Exception_HTTP' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-1.7.0/library/Requests/Exception/HTTP/405.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/src/Order.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception\\Http' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Http/Status405.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/src/Webhook.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception\\Http' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Http/Status407.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Requests_Exception' not found in wp-content/plugins/razorpay-subscription-button/razorpay-sdk/libs/Requests-1.7.0/library/Requests/Exception/HTTP.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: payments, ecommerce, razorpay, india

razorpay-subscription-button/razorpay-subscription-buttons.php 92% from 13 tests

This is the main PHP file of "Razorpay Subscription Button Plugin" version 1.0.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("razorpay-subscription-button.php" instead of "razorpay-subscription-buttons.php")

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
There were no executable files found in this plugin18,335 lines of code in 207 files:
LanguageFilesBlank linesComment linesLines of code
Markdown311,54108,730
PHP1652,1567,0908,442
SVG110494
JavaScript26783292
CSS248175
JSON300146
YAML39556

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity9.69
▷ Minimum class complexity1.00
▷ Maximum class complexity197.00
Average method complexity3.53
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces13
Interfaces10
Traits0
Classes153
▷ Abstract classes00.00%
▷ Concrete classes153100.00%
▷ Final classes4529.41%
Methods575
▷ Static methods12521.74%
▷ Public methods47682.78%
▷ Protected methods9015.65%
▷ Private methods91.57%
Functions3
▷ Named functions266.67%
▷ Anonymous functions133.33%
Constants71
▷ Global constants79.86%
▷ Class constants6490.14%
▷ Public constants64100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There were not PNG files found in your plugin