84% cocart-get-cart-enhanced

Code Review | CoCart - Cart Enhanced

WordPress plugin CoCart - Cart Enhanced scored84%from 54 tests.

About plugin

  • Plugin page: cocart-get-cart-e...
  • Plugin version: 4.0.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 17, 2020
  • Latest release: Aug 3, 2023
  • Number of updates: 55
  • Update frequency: every 22.4 days
  • Top authors: sebd86 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /5,538 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.09ms] Passed 4 tests

Analyzing server-side resources used by CoCart - Cart Enhanced
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0335.50 ▼4.14
Dashboard /wp-admin3.33 ▲0.0243.77 ▼6.52
Posts /wp-admin/edit.php3.44 ▲0.0845.17 ▲0.07
Add New Post /wp-admin/post-new.php5.91 ▲0.0289.92 ▼5.78
Media Library /wp-admin/upload.php3.25 ▲0.0233.10 ▲0.27

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 8 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for CoCart - Cart Enhanced
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.25 ▼1.421.75 ▲0.1842.50 ▲6.60
Dashboard /wp-admin2,206 ▲204.85 ▼0.10109.46 ▲3.6243.11 ▼2.10
Posts /wp-admin/edit.php2,092 ▲32.04 ▲0.0438.98 ▲2.9633.52 ▼1.10
Add New Post /wp-admin/post-new.php1,533 ▲1123.46 ▲0.22575.54 ▼74.1646.82 ▼4.64
Media Library /wp-admin/upload.php1,391 ▲64.19 ▼0.0295.04 ▼0.9240.61 ▼5.88

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts

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: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cocart-get-cart-enhanced/includes/filters/filter-v1.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cocart-get-cart-enhanced/includes/filters/filter-v2.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cocart-get-cart-enhanced/includes/filters/filter-v2-preview.php:27

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
6 plugin tags: cart, woocommerce, headless, decoupled, rest-api...

cocart-get-cart-enhanced/cocart-get-cart-enhanced.php Passed 13 tests

The entry point to "CoCart - Cart Enhanced" version 4.0.1 is a PHP file that has certain tags in its header comment area
56 characters long description:
Enhances the cart response to return additional details.

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
No dangerous file extensions were detected754 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP6245569754

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity30.50
▷ Minimum class complexity6.00
▷ Maximum class complexity64.00
Average method complexity4.47
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes125.00%
Methods34
▷ Static methods1338.24%
▷ Public methods3294.12%
▷ Protected methods25.88%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected