78% ns-custom-add-to-cart-button-for-woocoomerce

Code Review | NS Custom Add To Cart Button For Woocommerce

WordPress plugin NS Custom Add To Cart Button For Woocommerce scored78%from 54 tests.

About plugin

  • Plugin page: ns-custom-add-to-...
  • Plugin version: 1.2.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-5.9
  • WordPress version: 6.3.1
  • First release: Nov 7, 2016
  • Latest release: Feb 9, 2022
  • Number of updates: 42
  • Update frequency: every 45.7 days
  • Top authors: nsthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,728 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.02MB] [CPU: ▼9.01ms] Passed 4 tests

Server-side resources used by NS Custom Add To Cart Button For Woocommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0238.11 ▼3.93
Dashboard /wp-admin3.33 ▼0.0247.78 ▼13.81
Posts /wp-admin/edit.php3.44 ▲0.0951.90 ▼1.34
Add New Post /wp-admin/post-new.php5.93 ▲0.0491.67 ▼14.39
Media Library /wp-admin/upload.php3.25 ▲0.0236.23 ▼3.91
Custom Add to Cart /wp-admin/admin.php?page=ns-custom-add-to-cart-button-for-woocoomerce/ns-admin-options/ns_admin_option_dashboard.php3.2533.43
/wp-admin/admin.php?page=plugineye2373.2235.04
How to install premium version /wp-admin/admin.php?page=how-to-install-premium-version3.2032.65

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

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

Browser metrics Passed 4 tests

Checking browser requirements for NS Custom Add To Cart Button For Woocommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲7314.72 ▼0.041.87 ▼0.3344.26 ▼2.24
Dashboard /wp-admin2,210 ▲335.67 ▼0.0286.34 ▼1.8180.70 ▲38.55
Posts /wp-admin/edit.php2,133 ▲332.01 ▲0.0338.02 ▼3.1234.25 ▼2.35
Add New Post /wp-admin/post-new.php1,706 ▲15722.58 ▼0.61735.15 ▲57.0152.06 ▼8.94
Media Library /wp-admin/upload.php1,430 ▲304.16 ▼0.06106.93 ▲7.9477.91 ▲31.87
Custom Add to Cart /wp-admin/admin.php?page=ns-custom-add-to-cart-button-for-woocoomerce/ns-admin-options/ns_admin_option_dashboard.php9132.0122.5030.36
/wp-admin/admin.php?page=plugineye2379212.0324.1924.77
How to install premium version /wp-admin/admin.php?page=how-to-install-premium-version6911.536.5220.85

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

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

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=how-to-install-premium-version
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

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
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-custom-add-to-cart-button-for-woocoomerce/plugineye/plugineye-ajax/plugineye_on_deactivation_function.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 13 tag instead of maximum 10
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Settings Custom Add to Cart.), #2 (View single product example.), #3 (View shop page example.)
The official readme.txt is a good inspiration

ns-custom-add-to-cart-button-for-woocoomerce/ns-change-addcart.php 92% from 13 tests

The main PHP file in "NS Custom Add To Cart Button For Woocommerce" ver. 1.2.4 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("ns-custom-add-to-cart-button-for-woocoomerce.php" instead of "ns-change-addcart.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
Everything looks great! No dangerous files found in this plugin855 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP1173177551
CSS3228276
JavaScript14028

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity20.00
▷ Minimum class complexity20.00
▷ Maximum class complexity20.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods526.32%
▷ Protected methods00.00%
▷ Private methods1473.68%
Functions17
▷ Named functions741.18%
▷ Anonymous functions1058.82%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.30MB with 0.20MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png108.35KB43.05KB▼ 60.26%
ns-admin-options/img/backend-sidebar-icon.png1.48KB0.54KB▼ 63.47%
screenshot-1.png26.60KB6.68KB▼ 74.90%
screenshot-3.png117.97KB48.78KB▼ 58.65%
ns-admin-options/img/ns-theme-promo.png29.37KB8.96KB▼ 69.50%