felixarntz/wp-site-identity

View on GitHub

Showing 71 of 247 total issues

Method action_init has 179 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function action_init() {
        $registry = $this->plugin->services()->get( 'setting_registry' );
        $factory  = $registry->factory();

        $type_choices = $this->bootstrap->get_type_choices();
Severity: Major
Found in src/class-wp-site-identity-bootstrap-settings.php - About 7 hrs to fix

    File class-wp-site-identity-bootstrap-customizer.php has 372 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * WP_Site_Identity_Bootstrap_Customizer class
     *
     * @package WPSiteIdentity
    Severity: Minor
    Found in src/class-wp-site-identity-bootstrap-customizer.php - About 4 hrs to fix

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

          protected function format_address( $format, array $placeholders, array $placeholder_values ) {
              $formatted = str_replace( $placeholders, $placeholder_values, $format );
      
              $formatted_parts = array();
      
      
      Severity: Minor
      Found in src/class-wp-site-identity-owner-data.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 update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function update( $new_instance, $old_instance ) {
              $instance = $old_instance;
      
              foreach ( $this->fields as $attr => $field ) {
                  switch ( $field['type'] ) {
      Severity: Minor
      Found in src/widgets/class-wp-site-identity-widget.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 set_default_control_args_for_setting has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          private function set_default_control_args_for_setting( array $control_args, WP_Site_Identity_Setting $setting ) {
              $type = $setting->get_type();
      
              switch ( $type ) {
                  case 'boolean':
      Severity: Minor
      Found in src/class-wp-site-identity-bootstrap-customizer.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 add_owner_data_content has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function add_owner_data_content( $wp_customize, $setting_registry, $panel_slug ) {
              $registry     = $setting_registry->get_setting( 'owner_data' );
              $data         = $this->plugin->owner_data();
              $section_slug = 'owner_data';
      
      
      Severity: Major
      Found in src/class-wp-site-identity-bootstrap-customizer.php - About 4 hrs to fix

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

            public function form( $instance ) {
                $instance = wp_parse_args( (array) $instance, $this->get_defaults() );
        
                foreach ( $this->fields as $attr => $field ) {
                    $meta = $this->attrs( $field['meta'] );
        Severity: Minor
        Found in src/widgets/class-wp-site-identity-widget.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 form has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function form( $instance ) {
                $instance = wp_parse_args( (array) $instance, $this->get_defaults() );
        
                foreach ( $this->fields as $attr => $field ) {
                    $meta = $this->attrs( $field['meta'] );
        Severity: Major
        Found in src/widgets/class-wp-site-identity-widget.php - About 3 hrs to fix

          Function set_default_args_for_setting has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function set_default_args_for_setting( array $args, WP_Site_Identity_Setting $setting ) {
                  $type = isset( $args['type'] ) ? $args['type'] : $setting->get_type();
          
                  switch ( $type ) {
                      case 'boolean':

          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 add_brand_data_content has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function add_brand_data_content( $wp_customize, $setting_registry, $panel_slug ) {
                  $registry     = $setting_registry->get_setting( 'brand_data' );
                  $data         = $this->plugin->brand_data();
                  $section_slug = 'brand_data';
          
          
          Severity: Major
          Found in src/class-wp-site-identity-bootstrap-customizer.php - About 2 hrs to fix

            WP_Site_Identity_Settings_Field has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class WP_Site_Identity_Settings_Field {
            
                /**
                 * Slug of the settings field.
                 *

              Function render_site_identity_data_widget has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function render_site_identity_data_widget( $instance ) {
                      $owner_data = $this->plugin->owner_data();
              
                      $output = '';
              
              
              Severity: Minor
              Found in src/class-wp-site-identity-bootstrap-widgets.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 set_default_control_args_for_setting has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function set_default_control_args_for_setting( array $control_args, WP_Site_Identity_Setting $setting ) {
                      $type = $setting->get_type();
              
                      switch ( $type ) {
                          case 'boolean':
              Severity: Major
              Found in src/class-wp-site-identity-bootstrap-customizer.php - About 2 hrs to fix

                Method wpsi_load has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function wpsi_load() {
                    $classes_dir = plugin_dir_path( __FILE__ ) . 'src/';
                
                    // Main.
                    require_once $classes_dir . 'class-wp-site-identity.php';
                Severity: Major
                Found in wp-site-identity.php - About 2 hrs to fix

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

                      public function update( $new_instance, $old_instance ) {
                          $instance = $old_instance;
                  
                          foreach ( $this->fields as $attr => $field ) {
                              switch ( $field['type'] ) {
                  Severity: Major
                  Found in src/widgets/class-wp-site-identity-widget.php - About 2 hrs to fix

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

                        public function action_init() {
                            $registry = $this->plugin->services()->get( 'shortcode_registry' );
                            $factory  = $registry->factory();
                    
                            foreach ( $this->plugin->services()->get( 'setting_registry' )->get_all_settings() as $aggregate_setting ) {
                    Severity: Major
                    Found in src/class-wp-site-identity-bootstrap-shortcodes.php - About 2 hrs to fix

                      File class-wp-site-identity-settings-field-control-callbacks.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * WP_Site_Identity_Settings_Field_Control_Callbacks class
                       *
                       * @package WPSiteIdentity

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

                            protected function attrs( $attrs ) {
                                $output = '';
                        
                                foreach ( $attrs as $attr => $value ) {
                                    if ( is_bool( $value ) ) {
                        Severity: Minor
                        Found in src/widgets/class-wp-site-identity-widget.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

                        File class-wp-site-identity-widget.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * WP_Site_Identity_Widget class
                         *
                         * @package WPSiteIdentity
                        Severity: Minor
                        Found in src/widgets/class-wp-site-identity-widget.php - About 2 hrs to fix

                          Method action_handle_settings_page has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function action_handle_settings_page() {
                                  $setting_registry = $this->plugin->services()->get( 'setting_registry' );
                          
                                  $factory = $this->plugin->services()->get( 'settings_form_registry' )->factory();
                          
                          
                          Severity: Minor
                          Found in src/class-wp-site-identity-bootstrap-admin-pages.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language