WordPress/WordPress

View on GitHub
wp-includes/class-wp-customize-manager.php

Summary

Maintainability
F
1 mo
Test Coverage

File class-wp-customize-manager.php has 3719 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Customize Manager classes
 *
 * @package WordPress
Severity: Major
Found in wp-includes/class-wp-customize-manager.php - About 1 wk to fix

    Function import_theme_starter_content has a Cognitive Complexity of 209 (exceeds 5 allowed). Consider refactoring.
    Open

        public function import_theme_starter_content( $starter_content = array() ) {
            if ( empty( $starter_content ) ) {
                $starter_content = get_theme_starter_content();
            }
    
    
    Severity: Minor
    Found in wp-includes/class-wp-customize-manager.php - About 4 days 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 register_controls has 606 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function register_controls() {
    
            /* Themes (controls are loaded via ajax) */
    
            $this->add_panel(
    Severity: Major
    Found in wp-includes/class-wp-customize-manager.php - About 3 days to fix

      WP_Customize_Manager has 117 functions (exceeds 20 allowed). Consider refactoring.
      Open

      #[AllowDynamicProperties]
      final class WP_Customize_Manager {
          /**
           * An instance of the theme being previewed.
           *
      Severity: Major
      Found in wp-includes/class-wp-customize-manager.php - About 2 days to fix

        Function save_changeset_post has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save_changeset_post( $args = array() ) {
        
                $args = array_merge(
                    array(
                        'status'          => null,
        Severity: Minor
        Found in wp-includes/class-wp-customize-manager.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 import_theme_starter_content has 345 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function import_theme_starter_content( $starter_content = array() ) {
                if ( empty( $starter_content ) ) {
                    $starter_content = get_theme_starter_content();
                }
        
        
        Severity: Major
        Found in wp-includes/class-wp-customize-manager.php - About 1 day to fix

          Method render_control_templates has 259 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function render_control_templates() {
                  if ( $this->branching() ) {
                      $l10n = array(
                          /* translators: %s: User who is customizing the changeset in customizer. */
                          'locked'                => __( '%s is already customizing this changeset. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ),
          Severity: Major
          Found in wp-includes/class-wp-customize-manager.php - About 1 day to fix

            Method save_changeset_post has 244 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function save_changeset_post( $args = array() ) {
            
                    $args = array_merge(
                        array(
                            'status'          => null,
            Severity: Major
            Found in wp-includes/class-wp-customize-manager.php - About 1 day to fix

              Function save has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function save() {
                      if ( ! is_user_logged_in() ) {
                          wp_send_json_error( 'unauthenticated' );
                      }
              
              
              Severity: Minor
              Found in wp-includes/class-wp-customize-manager.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 customize_pane_settings has 182 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function customize_pane_settings() {
              
                      $login_url = add_query_arg(
                          array(
                              'interim-login'   => 1,
              Severity: Major
              Found in wp-includes/class-wp-customize-manager.php - About 7 hrs to fix

                Function customize_pane_settings has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function customize_pane_settings() {
                
                        $login_url = add_query_arg(
                            array(
                                'interim-login'   => 1,
                Severity: Minor
                Found in wp-includes/class-wp-customize-manager.php - About 6 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

                Method save has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function save() {
                        if ( ! is_user_logged_in() ) {
                            wp_send_json_error( 'unauthenticated' );
                        }
                
                
                Severity: Major
                Found in wp-includes/class-wp-customize-manager.php - About 5 hrs to fix

                  Function handle_dismiss_autosave_or_lock_request has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle_dismiss_autosave_or_lock_request() {
                          // Calls to dismiss_user_auto_draft_changesets() and wp_get_post_autosave() require non-zero get_current_user_id().
                          if ( ! is_user_logged_in() ) {
                              wp_send_json_error( 'unauthenticated', 401 );
                          }
                  Severity: Minor
                  Found in wp-includes/class-wp-customize-manager.php - About 4 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 _publish_changeset_values has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function _publish_changeset_values( $changeset_post_id ) {
                          global $wpdb;
                  
                          $publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
                          if ( is_wp_error( $publishing_changeset_data ) ) {
                  Severity: Minor
                  Found in wp-includes/class-wp-customize-manager.php - About 4 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 handle_load_themes_request has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle_load_themes_request() {
                          check_ajax_referer( 'switch_themes', 'nonce' );
                  
                          if ( ! current_user_can( 'switch_themes' ) ) {
                              wp_die( -1 );
                  Severity: Minor
                  Found in wp-includes/class-wp-customize-manager.php - About 4 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 unsanitized_post_values has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function unsanitized_post_values( $args = array() ) {
                          $args = array_merge(
                              array(
                                  'exclude_changeset' => false,
                                  'exclude_post_data' => ! current_user_can( 'customize' ),
                  Severity: Minor
                  Found in wp-includes/class-wp-customize-manager.php - About 4 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

                  Method handle_load_themes_request has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handle_load_themes_request() {
                          check_ajax_referer( 'switch_themes', 'nonce' );
                  
                          if ( ! current_user_can( 'switch_themes' ) ) {
                              wp_die( -1 );
                  Severity: Major
                  Found in wp-includes/class-wp-customize-manager.php - About 4 hrs to fix

                    Method _publish_changeset_values has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _publish_changeset_values( $changeset_post_id ) {
                            global $wpdb;
                    
                            $publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
                            if ( is_wp_error( $publishing_changeset_data ) ) {
                    Severity: Major
                    Found in wp-includes/class-wp-customize-manager.php - About 4 hrs to fix

                      Function validate_setting_values has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function validate_setting_values( $setting_values, $options = array() ) {
                              $options = wp_parse_args(
                                  $options,
                                  array(
                                      'validate_capability' => false,
                      Severity: Minor
                      Found in wp-includes/class-wp-customize-manager.php - About 4 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

                      Method customize_preview_settings has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function customize_preview_settings() {
                              $post_values                 = $this->unsanitized_post_values( array( 'exclude_changeset' => true ) );
                              $setting_validities          = $this->validate_setting_values( $post_values );
                              $exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
                      
                      
                      Severity: Major
                      Found in wp-includes/class-wp-customize-manager.php - About 4 hrs to fix

                        Method __construct has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function __construct( $args = array() ) {
                        
                                $args = array_merge(
                                    array_fill_keys( array( 'changeset_uuid', 'theme', 'messenger_channel', 'settings_previewed', 'autosaved', 'branching' ), null ),
                                    $args
                        Severity: Major
                        Found in wp-includes/class-wp-customize-manager.php - About 3 hrs to fix

                          Function customize_preview_settings has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function customize_preview_settings() {
                                  $post_values                 = $this->unsanitized_post_values( array( 'exclude_changeset' => true ) );
                                  $setting_validities          = $this->validate_setting_values( $post_values );
                                  $exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
                          
                          
                          Severity: Minor
                          Found in wp-includes/class-wp-customize-manager.php - About 3 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

                          Method prepare_controls has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function prepare_controls() {
                          
                                  $controls       = array();
                                  $this->controls = wp_list_sort(
                                      $this->controls,
                          Severity: Major
                          Found in wp-includes/class-wp-customize-manager.php - About 3 hrs to fix

                            Function prepare_starter_content_attachments has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function prepare_starter_content_attachments( $attachments ) {
                                    $prepared_attachments = array();
                                    if ( empty( $attachments ) ) {
                                        return $prepared_attachments;
                                    }
                            Severity: Minor
                            Found in wp-includes/class-wp-customize-manager.php - About 3 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 setup_theme has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function setup_theme() {
                                    global $pagenow;
                            
                                    // Check permissions for customize.php access since this method is called before customize.php can run any code.
                                    if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) {
                            Severity: Minor
                            Found in wp-includes/class-wp-customize-manager.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 _sanitize_background_setting has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function _sanitize_background_setting( $value, $setting ) {
                                    if ( 'background_repeat' === $setting->id ) {
                                        if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
                                            return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
                                        }
                            Severity: Minor
                            Found in wp-includes/class-wp-customize-manager.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

                            Method handle_changeset_trash_request has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handle_changeset_trash_request() {
                                    if ( ! is_user_logged_in() ) {
                                        wp_send_json_error( 'unauthenticated' );
                                    }
                            
                            
                            Severity: Major
                            Found in wp-includes/class-wp-customize-manager.php - About 2 hrs to fix

                              Function changeset_data has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function changeset_data() {
                                      if ( isset( $this->_changeset_data ) ) {
                                          return $this->_changeset_data;
                                      }
                                      $changeset_post_id = $this->changeset_post_id();
                              Severity: Minor
                              Found in wp-includes/class-wp-customize-manager.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 prepare_controls has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function prepare_controls() {
                              
                                      $controls       = array();
                                      $this->controls = wp_list_sort(
                                          $this->controls,
                              Severity: Minor
                              Found in wp-includes/class-wp-customize-manager.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

                              Method setup_theme has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function setup_theme() {
                                      global $pagenow;
                              
                                      // Check permissions for customize.php access since this method is called before customize.php can run any code.
                                      if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) {
                              Severity: Major
                              Found in wp-includes/class-wp-customize-manager.php - About 2 hrs to fix

                                Method handle_dismiss_autosave_or_lock_request has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function handle_dismiss_autosave_or_lock_request() {
                                        // Calls to dismiss_user_auto_draft_changesets() and wp_get_post_autosave() require non-zero get_current_user_id().
                                        if ( ! is_user_logged_in() ) {
                                            wp_send_json_error( 'unauthenticated', 401 );
                                        }
                                Severity: Minor
                                Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                  Method unsanitized_post_values has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function unsanitized_post_values( $args = array() ) {
                                          $args = array_merge(
                                              array(
                                                  'exclude_changeset' => false,
                                                  'exclude_post_data' => ! current_user_can( 'customize' ),
                                  Severity: Minor
                                  Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                    Method validate_setting_values has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function validate_setting_values( $setting_values, $options = array() ) {
                                            $options = wp_parse_args(
                                                $options,
                                                array(
                                                    'validate_capability' => false,
                                    Severity: Minor
                                    Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                      Function __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function __construct( $args = array() ) {
                                      
                                              $args = array_merge(
                                                  array_fill_keys( array( 'changeset_uuid', 'theme', 'messenger_channel', 'settings_previewed', 'autosaved', 'branching' ), null ),
                                                  $args
                                      Severity: Minor
                                      Found in wp-includes/class-wp-customize-manager.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 register_controls has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function register_controls() {
                                      
                                              /* Themes (controls are loaded via ajax) */
                                      
                                              $this->add_panel(
                                      Severity: Minor
                                      Found in wp-includes/class-wp-customize-manager.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

                                      Method prepare_starter_content_attachments has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function prepare_starter_content_attachments( $attachments ) {
                                              $prepared_attachments = array();
                                              if ( empty( $attachments ) ) {
                                                  return $prepared_attachments;
                                              }
                                      Severity: Minor
                                      Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                        Function handle_changeset_trash_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function handle_changeset_trash_request() {
                                                if ( ! is_user_logged_in() ) {
                                                    wp_send_json_error( 'unauthenticated' );
                                                }
                                        
                                        
                                        Severity: Minor
                                        Found in wp-includes/class-wp-customize-manager.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

                                        Method trash_changeset_post has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function trash_changeset_post( $post ) {
                                                global $wpdb;
                                        
                                                $post = get_post( $post );
                                        
                                        
                                        Severity: Minor
                                        Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                          Method _sanitize_background_setting has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              public function _sanitize_background_setting( $value, $setting ) {
                                                  if ( 'background_repeat' === $setting->id ) {
                                                      if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
                                                          return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
                                                      }
                                          Severity: Minor
                                          Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                            Method handle_override_changeset_lock_request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public function handle_override_changeset_lock_request() {
                                                    if ( ! $this->is_preview() ) {
                                                        wp_send_json_error( 'not_preview', 400 );
                                                    }
                                            
                                            
                                            Severity: Minor
                                            Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                              Method wp_die has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  protected function wp_die( $ajax_message, $message = null ) {
                                                      if ( $this->doing_ajax() ) {
                                                          wp_die( $ajax_message );
                                                      }
                                              
                                              
                                              Severity: Minor
                                              Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                Method add_state_query_params has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    public function add_state_query_params( $url ) {
                                                        $parsed_original_url = wp_parse_url( $url );
                                                        $is_allowed          = false;
                                                        foreach ( $this->get_allowed_urls() as $allowed_url ) {
                                                            $parsed_allowed_url = wp_parse_url( $allowed_url );
                                                Severity: Minor
                                                Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                  Function establish_loaded_changeset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                      public function establish_loaded_changeset() {
                                                          global $pagenow;
                                                  
                                                          if ( empty( $this->_changeset_uuid ) ) {
                                                              $changeset_uuid = null;
                                                  Severity: Minor
                                                  Found in wp-includes/class-wp-customize-manager.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 get_return_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                      public function get_return_url() {
                                                          global $_registered_pages;
                                                  
                                                          $referer                    = wp_get_referer();
                                                          $excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
                                                  Severity: Minor
                                                  Found in wp-includes/class-wp-customize-manager.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 add_state_query_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                      public function add_state_query_params( $url ) {
                                                          $parsed_original_url = wp_parse_url( $url );
                                                          $is_allowed          = false;
                                                          foreach ( $this->get_allowed_urls() as $allowed_url ) {
                                                              $parsed_allowed_url = wp_parse_url( $allowed_url );
                                                  Severity: Minor
                                                  Found in wp-includes/class-wp-customize-manager.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

                                                  Method establish_loaded_changeset has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      public function establish_loaded_changeset() {
                                                          global $pagenow;
                                                  
                                                          if ( empty( $this->_changeset_uuid ) ) {
                                                              $changeset_uuid = null;
                                                  Severity: Minor
                                                  Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                    Method get_changeset_posts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        protected function get_changeset_posts( $args = array() ) {
                                                            $default_args = array(
                                                                'exclude_restore_dismissed' => true,
                                                                'posts_per_page'            => -1,
                                                                'post_type'                 => 'customize_changeset',
                                                    Severity: Minor
                                                    Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                      Method changeset_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          public function changeset_data() {
                                                              if ( isset( $this->_changeset_data ) ) {
                                                                  return $this->_changeset_data;
                                                              }
                                                              $changeset_post_id = $this->changeset_post_id();
                                                      Severity: Minor
                                                      Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                        Method customize_preview_init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            public function customize_preview_init() {
                                                        
                                                                /*
                                                                 * Now that Customizer previews are loaded into iframes via GET requests
                                                                 * and natural URLs with transaction UUIDs added, we need to ensure that
                                                        Severity: Minor
                                                        Found in wp-includes/class-wp-customize-manager.php - About 1 hr to fix

                                                          Function get_changeset_post_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              protected function get_changeset_post_data( $post_id ) {
                                                                  if ( ! $post_id ) {
                                                                      return new WP_Error( 'empty_post_id' );
                                                                  }
                                                                  $changeset_post = get_post( $post_id );
                                                          Severity: Minor
                                                          Found in wp-includes/class-wp-customize-manager.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

                                                          Consider simplifying this complex logical expression.
                                                          Open

                                                                  if (
                                                                      isset( $data['post_type'] ) &&
                                                                      isset( $unsanitized_postarr['post_content'] ) &&
                                                                      'customize_changeset' === $data['post_type'] ||
                                                                      (
                                                          Severity: Major
                                                          Found in wp-includes/class-wp-customize-manager.php - About 40 mins to fix

                                                            Function check_changeset_lock_with_heartbeat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function check_changeset_lock_with_heartbeat( $response, $data, $screen_id ) {
                                                                    if ( isset( $data['changeset_uuid'] ) ) {
                                                                        $changeset_post_id = $this->find_changeset_post_id( $data['changeset_uuid'] );
                                                                    } else {
                                                                        $changeset_post_id = $this->changeset_post_id();
                                                            Severity: Minor
                                                            Found in wp-includes/class-wp-customize-manager.php - About 35 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 add_dynamic_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function add_dynamic_settings( $setting_ids ) {
                                                                    $new_settings = array();
                                                                    foreach ( $setting_ids as $setting_id ) {
                                                                        // Skip settings already created.
                                                                        if ( $this->get_setting( $setting_id ) ) {
                                                            Severity: Minor
                                                            Found in wp-includes/class-wp-customize-manager.php - About 35 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

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return new WP_Error( 'changeset_post_save_failure', '', $response );
                                                            Severity: Major
                                                            Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      return $value;
                                                              Severity: Major
                                                              Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return new WP_Error( 'cannot_schedule_theme_switches' ); // This should be allowed in the future, when theme is a regular setting.
                                                                Severity: Major
                                                                Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) );
                                                                  Severity: Major
                                                                  Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return new WP_Error( 'cannot_supply_date_for_auto_draft_changeset' );
                                                                    Severity: Major
                                                                    Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return new WP_Error( 'not_future_date', __( 'You must supply a future date to schedule.' ) );
                                                                      Severity: Major
                                                                      Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    return new WP_Error( 'transaction_fail', '', $response );
                                                                        Severity: Major
                                                                        Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                  return $post;
                                                                          Severity: Major
                                                                          Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                            return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
                                                                            Severity: Major
                                                                            Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return new WP_Error( 'json_parse_error', '', $last_error );
                                                                              Severity: Major
                                                                              Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return new WP_Error( 'expected_array' );
                                                                                Severity: Major
                                                                                Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                  return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
                                                                                  Severity: Major
                                                                                  Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return new WP_Error( 'illegal_autosave_with_date_gmt' );
                                                                                    Severity: Major
                                                                                    Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return new WP_Error( 'illegal_autosave_with_status' );
                                                                                      Severity: Major
                                                                                      Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                return $response;
                                                                                        Severity: Major
                                                                                        Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                  return $changeset_data;
                                                                                          Severity: Major
                                                                                          Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                            return new WP_Error( 'illegal_autosave_with_non_current_user' );
                                                                                            Severity: Major
                                                                                            Found in wp-includes/class-wp-customize-manager.php - About 30 mins to fix

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

                                                                                                  public function has_published_pages() {
                                                                                              
                                                                                                      $setting = $this->get_setting( 'nav_menus_created_posts' );
                                                                                                      if ( $setting ) {
                                                                                                          foreach ( $setting->value() as $post_id ) {
                                                                                              Severity: Minor
                                                                                              Found in wp-includes/class-wp-customize-manager.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 set_changeset_lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  public function set_changeset_lock( $changeset_post_id, $take_over = false ) {
                                                                                                      if ( $changeset_post_id ) {
                                                                                                          $can_override = ! (bool) get_post_meta( $changeset_post_id, '_edit_lock', true );
                                                                                              
                                                                                                          if ( $take_over ) {
                                                                                              Severity: Minor
                                                                                              Found in wp-includes/class-wp-customize-manager.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 _validate_header_video has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  public function _validate_header_video( $validity, $value ) {
                                                                                                      $video = get_attached_file( absint( $value ) );
                                                                                                      if ( $video ) {
                                                                                                          $size = filesize( $video );
                                                                                                          if ( $size > 8 * MB_IN_BYTES ) {
                                                                                              Severity: Minor
                                                                                              Found in wp-includes/class-wp-customize-manager.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 dismiss_user_auto_draft_changesets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  protected function dismiss_user_auto_draft_changesets() {
                                                                                                      $changeset_autodraft_posts = $this->get_changeset_posts(
                                                                                                          array(
                                                                                                              'post_status'               => 'auto-draft',
                                                                                                              'exclude_restore_dismissed' => true,
                                                                                              Severity: Minor
                                                                                              Found in wp-includes/class-wp-customize-manager.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

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( is_serialized( $value ) ) {
                                                                                                              if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) {
                                                                                                                  if ( isset( $posts[ $matches['symbol'] ] ) ) {
                                                                                                                      $symbol_match = $posts[ $matches['symbol'] ]['ID'];
                                                                                                                  } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
                                                                                              Severity: Major
                                                                                              Found in wp-includes/class-wp-customize-manager.php and 1 other location - About 6 hrs to fix
                                                                                              wp-includes/class-wp-customize-manager.php on lines 1540..1564

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 215.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ( is_serialized( $value ) ) {
                                                                                                              if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) {
                                                                                                                  if ( isset( $posts[ $matches['symbol'] ] ) ) {
                                                                                                                      $symbol_match = $posts[ $matches['symbol'] ]['ID'];
                                                                                                                  } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
                                                                                              Severity: Major
                                                                                              Found in wp-includes/class-wp-customize-manager.php and 1 other location - About 6 hrs to fix
                                                                                              wp-includes/class-wp-customize-manager.php on lines 1582..1606

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 215.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( ! $this->is_theme_active() ) {
                                                                                                          remove_filter( 'template', array( $this, 'get_template' ) );
                                                                                                          remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
                                                                                                          remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
                                                                                              
                                                                                              
                                                                                              Severity: Major
                                                                                              Found in wp-includes/class-wp-customize-manager.php and 1 other location - About 3 hrs to fix
                                                                                              wp-includes/class-wp-customize-manager.php on lines 682..694

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 150.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                      if ( ! $this->is_theme_active() ) {
                                                                                                          add_filter( 'template', array( $this, 'get_template' ) );
                                                                                                          add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
                                                                                                          add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
                                                                                              
                                                                                              
                                                                                              Severity: Major
                                                                                              Found in wp-includes/class-wp-customize-manager.php and 1 other location - About 3 hrs to fix
                                                                                              wp-includes/class-wp-customize-manager.php on lines 720..732

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 150.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                  public function add_setting( $id, $args = array() ) {
                                                                                                      if ( $id instanceof WP_Customize_Setting ) {
                                                                                                          $setting = $id;
                                                                                                      } else {
                                                                                                          $class = 'WP_Customize_Setting';
                                                                                              Severity: Major
                                                                                              Found in wp-includes/class-wp-customize-manager.php and 1 other location - About 2 hrs to fix
                                                                                              wp-includes/customize/class-wp-customize-selective-refresh.php on lines 95..112

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 122.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              There are no issues that match your filters.

                                                                                              Category
                                                                                              Status