CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/import/blogger.php

Summary

Maintainability
F
1 wk
Test Coverage

File blogger.php has 854 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Blogger Importer
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 2 days to fix

    Function import_blog has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        function import_blog($blogID) {
            global $importing_blog;
            $importing_blog = $blogID;
    
            if ( isset($_GET['authors']) )
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 show_blogs has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function show_blogs($iter = 0) {
            if ( empty($this->blogs) ) {
                $headers = array(
                    "GET /feeds/default/blogs HTTP/1.0",
                    "Host: www.blogger.com",
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 1 day to fix

      Function show_blogs has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          function show_blogs($iter = 0) {
              if ( empty($this->blogs) ) {
                  $headers = array(
                      "GET /feeds/default/blogs HTTP/1.0",
                      "Host: www.blogger.com",
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 5 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 import_blog has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function import_blog($blogID) {
              global $importing_blog;
              $importing_blog = $blogID;
      
              if ( isset($_GET['authors']) )
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 4 hrs to fix

        Blogger_Import has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Blogger_Import {
        
            // Shows the welcome screen and the magic auth link.
            function greet() {
                $next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&amp;noheader=true';
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 3 hrs to fix

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

              function start_element($parser, $name, $attrs) {
          
                  $tag = array_pop(split(":", $name));
          
                  array_unshift($this->ns_contexts, $this->ns_decls);
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 import_post has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function import_post( $entry ) {
                  global $importing_blog;
          
                  // The old permalink is all Blogger gives us to link comments to their posts.
                  if ( isset( $entry->draft ) )
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 1 hr to fix

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

                function start() {
                    if ( isset($_POST['restart']) )
                        $this->restart();
            
                    $options = get_option('blogger_importer');
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 end_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                function end_element($parser, $name) {
            
                    $tag = array_pop(split(":", $name));
            
                    if(!empty($this->in_content)) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 import_post has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                function import_post( $entry ) {
                    global $importing_blog;
            
                    // The old permalink is all Blogger gives us to link comments to their posts.
                    if ( isset( $entry->draft ) )
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 ns_to_prefix has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                function ns_to_prefix($qname) {
                    $components = split(":", $qname);
                    $name = array_pop($components);
            
                    if(!empty($components)) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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 import_comment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function import_comment( $entry ) {
                    global $importing_blog;
            
                    // Drop the #fragment and we have the comment's old post permalink.
                    foreach ( $entry->links as $link ) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 1 hr to fix

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

                  function start_element($parser, $name, $attrs) {
              
                      $tag = array_pop(split(":", $name));
              
                      array_unshift($this->ns_contexts, $this->ns_decls);
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.php - About 1 hr to fix

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

                    function import_comment( $entry ) {
                        global $importing_blog;
                
                        // Drop the #fragment and we have the comment's old post permalink.
                        foreach ( $entry->links as $link ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/import/blogger.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

                There are no issues that match your filters.

                Category
                Status