abaicus/ti-onboarding

View on GitHub

Showing 96 of 96 total issues

File class-themeisle-ob-wxr-importer.php has 839 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Author:          Andrei Baicus <andrei@themeisle.com>
 * Created on:      12/07/2018
 *

    File class-themeisle-ob-zelle-importer.php has 659 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Import Zelle to Elementor template.
     *
     * @package themeisle-onboarding
    Severity: Major
    Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 1 day to fix

      Function actually_import has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          private function actually_import( $data ) {
              global $wp_registered_sidebars;
              if ( empty( $data ) || ! is_array( $data ) ) {
                  return new WP_Error( 'ti__ob_widget_err_1' );
              }
      Severity: Minor
      Found in includes/importers/class-themeisle-ob-widgets-importer.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

      Function map_our_team_section has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          function map_our_team_section() {
              if ( isset( $this->previous_theme_content['zerif_ourteam_show'] ) && $this->previous_theme_content['zerif_ourteam_show'] ) {
                  unset( $this->content[4] );
      
                  return;
      Severity: Minor
      Found in includes/importers/class-themeisle-ob-zelle-importer.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

      File class-themeisle-ob-rest-server.php has 377 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Onboarding Rest Endpoints Handler.
       *
       * Author:          Andrei Baicus <andrei@themeisle.com>
      Severity: Minor
      Found in includes/class-themeisle-ob-rest-server.php - About 5 hrs to fix

        Function parse_post_node has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function parse_post_node( $node ) {
                $data     = array();
                $meta     = array();
                $comments = array();
                $terms    = array();

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

            protected function process_post( $data, $meta, $comments, $terms ) {
                /**
                 * Pre-process post data.
                 *
                 * @param array $data     Post data. (Return empty to skip.)

          Function process_post has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function process_post( $data, $meta, $comments, $terms ) {
                  /**
                   * Pre-process post data.
                   *
                   * @param array $data     Post data. (Return empty to skip.)

          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 import has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              public function import( $file ) {
                  add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
                  add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
          
                  $result = $this->import_start( $file );

          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_sidebar_content has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              private function get_sidebar_content( $widget_ids, $prefix ) {
                  if ( empty( $widget_ids ) ) {
                      return '';
                  }
                  $data_in_hestia_format = array();
          Severity: Minor
          Found in includes/importers/class-themeisle-ob-zelle-importer.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

          Themeisle_OB_WXR_Importer has 32 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Themeisle_OB_WXR_Importer extends WP_Importer {
              /**
               * Maximum supported WXR version
               */
              const MAX_WXR_VERSION = 1.2;

            Method parse_post_node has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function parse_post_node( $node ) {
                    $data     = array();
                    $meta     = array();
                    $comments = array();
                    $terms    = array();

              Function post_process_posts has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function post_process_posts( $todo ) {
                      foreach ( $todo as $post_id => $_ ) {
                          $data = array();
              
                          $parent_id = get_post_meta( $post_id, '_wxr_import_parent', true );

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

                  public function import( $file ) {
                      add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
                      add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
              
                      $result = $this->import_start( $file );

                Method map_our_team_section has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function map_our_team_section() {
                        if ( isset( $this->previous_theme_content['zerif_ourteam_show'] ) && $this->previous_theme_content['zerif_ourteam_show'] ) {
                            unset( $this->content[4] );
                
                            return;
                Severity: Major
                Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 3 hrs to fix

                  Method actually_import has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function actually_import( $data ) {
                          global $wp_registered_sidebars;
                          if ( empty( $data ) || ! is_array( $data ) ) {
                              return new WP_Error( 'ti__ob_widget_err_1' );
                          }
                  Severity: Major
                  Found in includes/importers/class-themeisle-ob-widgets-importer.php - About 3 hrs to fix

                    Method import_remote_xml has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function import_remote_xml( WP_REST_Request $request ) {
                            if ( ! current_user_can( 'manage_options' ) ) {
                                return new WP_REST_Response(
                                    array(
                                        'data'    => 'ti__ob_permission_err_1',
                    Severity: Major
                    Found in includes/importers/class-themeisle-ob-content-importer.php - About 3 hrs to fix

                      Method register_endpoints has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function register_endpoints() {
                              register_rest_route(
                                  Themeisle_Onboarding::API_ROOT,
                                  '/initialize_sites_library',
                                  array(
                      Severity: Major
                      Found in includes/class-themeisle-ob-rest-server.php - About 3 hrs to fix

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

                            protected function process_post_meta( $meta, $post_id, $post ) {
                                if ( empty( $meta ) ) {
                                    return true;
                                }
                        
                        

                        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 map_testimonials_section has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function map_testimonials_section() {
                                if ( isset( $this->previous_theme_content['zerif_testimonials_show'] ) && $this->previous_theme_content['zerif_testimonials_show'] ) {
                                    unset( $this->content[5] );
                        
                                    return;
                        Severity: Minor
                        Found in includes/importers/class-themeisle-ob-zelle-importer.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

                        Severity
                        Category
                        Status
                        Source
                        Language