woothemes/woocommerce

View on GitHub
includes/shortcodes/class-wc-shortcode-checkout.php

Summary

Maintainability
D
2 days
Test Coverage

Function order_pay has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

    private static function order_pay( $order_id ) {

        do_action( 'before_woocommerce_pay' );

        $order_id = absint( $order_id );
Severity: Minor
Found in includes/shortcodes/class-wc-shortcode-checkout.php - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method order_pay has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function order_pay( $order_id ) {

        do_action( 'before_woocommerce_pay' );

        $order_id = absint( $order_id );
Severity: Major
Found in includes/shortcodes/class-wc-shortcode-checkout.php - About 3 hrs to fix

    Function output has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function output( $atts ) {
            global $wp;
    
            // Check cart class is loaded or abort.
            if ( is_null( WC()->cart ) ) {
    Severity: Minor
    Found in includes/shortcodes/class-wc-shortcode-checkout.php - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function order_received has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function order_received( $order_id = 0 ) {
            $order = false;
    
            // Get the order.
            $order_id  = apply_filters( 'woocommerce_thankyou_order_id', absint( $order_id ) );
    Severity: Minor
    Found in includes/shortcodes/class-wc-shortcode-checkout.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function checkout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function checkout() {
            // Show non-cart errors.
            do_action( 'woocommerce_before_checkout_form_cart_notices' );
    
            // Check cart has contents.
    Severity: Minor
    Found in includes/shortcodes/class-wc-shortcode-checkout.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status