woothemes/woocommerce

View on GitHub
includes/admin/settings/class-wc-settings-emails.php

Summary

Maintainability
D
1 day
Test Coverage

Method get_settings has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_settings() {
        $settings = apply_filters(
            'woocommerce_email_settings',
            array(
                array(
Severity: Major
Found in includes/admin/settings/class-wc-settings-emails.php - About 5 hrs to fix

    Method email_notification_setting has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function email_notification_setting() {
            // Define emails that can be customised here.
            $mailer          = WC()->mailer();
            $email_templates = $mailer->get_emails();
    
    
    Severity: Major
    Found in includes/admin/settings/class-wc-settings-emails.php - About 3 hrs to fix

      File class-wc-settings-emails.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * WooCommerce Email Settings
       *
       * @package WooCommerce\Admin
      Severity: Minor
      Found in includes/admin/settings/class-wc-settings-emails.php - About 2 hrs to fix

        Function email_notification_setting has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function email_notification_setting() {
                // Define emails that can be customised here.
                $mailer          = WC()->mailer();
                $email_templates = $mailer->get_emails();
        
        
        Severity: Minor
        Found in includes/admin/settings/class-wc-settings-emails.php - About 2 hrs 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 save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save() {
                global $current_section;
        
                if ( ! $current_section ) {
                    WC_Admin_Settings::save_fields( $this->get_settings() );
        Severity: Minor
        Found in includes/admin/settings/class-wc-settings-emails.php - About 1 hr 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 output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function output() {
                global $current_section;
        
                // Define emails that can be customised here.
                $mailer          = WC()->mailer();
        Severity: Minor
        Found in includes/admin/settings/class-wc-settings-emails.php - About 45 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