abaicus/ti-onboarding

View on GitHub

Showing 96 of 96 total issues

Function map_bigtitle_section has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    function map_bigtitle_section() {
        if ( isset( $this->previous_theme_content['zerif_bigtitle_show'] ) && $this->previous_theme_content['zerif_bigtitle_show'] ) {
            unset( $this->content[0] );

            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

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

  Vue.http({
    url: themeisleSitesLibApi.root + '/import_theme_mods',
    method: 'POST',
    headers: {'X-WP-Nonce': themeisleSitesLibApi.nonce},
    params: {
Severity: Major
Found in assets/vue/store/actions.js and 2 other locations - About 2 hrs to fix
assets/vue/store/actions.js on lines 199..219
assets/vue/store/actions.js on lines 257..273

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 88.

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 3 locations. Consider refactoring.
Open

  Vue.http({
    url: themeisleSitesLibApi.root + '/import_widgets',
    method: 'POST',
    headers: {'X-WP-Nonce': themeisleSitesLibApi.nonce},
    params: {
Severity: Major
Found in assets/vue/store/actions.js and 2 other locations - About 2 hrs to fix
assets/vue/store/actions.js on lines 167..187
assets/vue/store/actions.js on lines 257..273

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 88.

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 3 locations. Consider refactoring.
Open

  Vue.http({
    url: themeisleSitesLibApi.root + '/dismiss_migration',
    method: 'POST',
    headers: {'X-WP-Nonce': themeisleSitesLibApi.nonce},
    params: {
Severity: Major
Found in assets/vue/store/actions.js and 2 other locations - About 2 hrs to fix
assets/vue/store/actions.js on lines 167..187
assets/vue/store/actions.js on lines 199..219

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 88.

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

Method map_bigtitle_section has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function map_bigtitle_section() {
        if ( isset( $this->previous_theme_content['zerif_bigtitle_show'] ) && $this->previous_theme_content['zerif_bigtitle_show'] ) {
            unset( $this->content[0] );

            return;
Severity: Major
Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 2 hrs to fix

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

        function map_ribbon_section() {
            if ( ! empty( $this->previous_theme_content['zerif_ribbon_background'] ) ) {
                $this->content[2]['settings']['background_color'] = wp_kses_post( $this->previous_theme_content['zerif_ribbon_background'] );
            }
    
    
    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

    File actions.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* jshint esversion: 6 */
    /* global themeisleSitesLibApi, console */
    import Vue from 'vue'
    import VueResource from 'vue-resource'
    
    
    Severity: Minor
    Found in assets/vue/store/actions.js - About 2 hrs to fix

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

          function map_ribbon_section() {
              if ( ! empty( $this->previous_theme_content['zerif_ribbon_background'] ) ) {
                  $this->content[2]['settings']['background_color'] = wp_kses_post( $this->previous_theme_content['zerif_ribbon_background'] );
              }
      
      
      Severity: Major
      Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 2 hrs to fix

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

            private function get_repeater_social( $social_name, $value ) {
                $result = array(
                    'icon' => '',
                    'link' => $value,
                );
        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

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

            private function get_upsell_templates() {
                if ( $this->valid_lic === true ) {
                    return array();
                }
                $returnable = array();
        Severity: Minor
        Found in includes/class-themeisle-ob-rest-server.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 get_remote_templates has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private function get_remote_templates() {
                if ( $this->valid_lic === false ) {
                    return array();
                }
        
        
        Severity: Minor
        Found in includes/class-themeisle-ob-rest-server.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 get_repeater_social has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function get_repeater_social( $social_name, $value ) {
                $result = array(
                    'icon' => '',
                    'link' => $value,
                );
        Severity: Major
        Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 2 hrs to fix

          Method map_our_focus_section has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method import_theme_mods has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function import_theme_mods( WP_REST_Request $request ) {
                    if ( ! current_user_can( 'customize' ) ) {
                        return new WP_REST_Response(
                            array(
                                'data'    => 'ti__ob_permission_err_2',
            Severity: Minor
            Found in includes/importers/class-themeisle-ob-theme-mods-importer.php - About 1 hr to fix

              Method import_zelle_frontpage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function import_zelle_frontpage( $template_path ) {
                      $this->previous_theme_content = get_option( 'theme_mods_zerif-pro' );
                      if ( empty( $this->previous_theme_content ) ) {
                          $this->previous_theme_content = get_option( 'theme_mods_zerif-lite' );
                      }
              Severity: Minor
              Found in includes/importers/class-themeisle-ob-zelle-importer.php - About 1 hr to fix

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

                    protected function fetch_remote_file( $url, $post ) {
                        // extract the file name and extension from the url
                        $file_name = basename( $url );
                
                        // get placeholder file in the upload dir with a unique, sanitized filename

                  Method map_testimonials_section has 45 lines of code (exceeds 25 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 1 hr to fix

                    Method parse_term_node has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function parse_term_node( $node, $type = 'term' ) {
                            $data = array();
                            $meta = array();
                    
                            $tag_name = array(

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

                          private function install_single_plugin( $plugin_slug ) {
                              $plugin_dir = WP_PLUGIN_DIR . '/' . $plugin_slug;
                      
                              if ( is_dir( $plugin_dir ) ) {
                                  return;
                      Severity: Minor
                      Found in includes/importers/class-themeisle-ob-plugin-importer.php - About 1 hr to fix

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

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

                        Severity
                        Category
                        Status
                        Source
                        Language