CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php

Summary

Maintainability
F
2 wks
Test Coverage

File class-ftp.php has 752 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * PemFTP - A Ftp implementation in pure PHP
 *
 * @package PemFTP
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 day to fix

    ftp_base has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ftp_base {
        /* Public variables */
        var $LocalEcho;
        var $Verbose;
        var $OS_local;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 6 hrs to fix

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

          function mget($remote, $local=".", $continious=false) {
              $list=$this->rawlist($remote, "-lA");
              if($list===false) {
                  $this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
                  return FALSE;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 parselisting has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          function parselisting($line) {
              $is_windows = ($this->OS_remote == FTP_OS_Windows);
              if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
                  $b = array();
                  if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 mdel has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          function mdel($remote, $continious=false) {
              $list=$this->rawlist($remote, "-la");
              if($list===false) {
                  $this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
                  return false;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 mput has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          function mput($local=".", $remote=NULL, $continious=false) {
              $local=realpath($local);
              if(!@file_exists($local)) {
                  $this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\"");
                  return FALSE;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 glob has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          function glob($pattern, $handle=NULL) {
              $path=$output=null;
              if(PHP_OS=='WIN32') $slash='\\';
              else $slash='/';
              $lastpos=strrpos($pattern,$slash);
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 SetServer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          function SetServer($host, $port=21, $reconnect=true) {
              if(!is_long($port)) {
                  $this->verbose=true;
                  $this->SendMSG("Incorrect port syntax");
                  return FALSE;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 parselisting has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function parselisting($line) {
              $is_windows = ($this->OS_remote == FTP_OS_Windows);
              if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
                  $b = array();
                  if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 2 hrs to fix

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

            function connect($server=NULL) {
                if(!empty($server)) {
                    if(!$this->SetServer($server)) return false;
                }
                if($this->_ready) return true;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 _settype has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            function _settype($mode=FTP_ASCII) {
                if($this->_ready) {
                    if($mode==FTP_BINARY) {
                        if($this->_curtype!=FTP_BINARY) {
                            if(!$this->_exec("TYPE I", "SetType")) return FALSE;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 login has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            function login($user=NULL, $pass=NULL) {
                if(!is_null($user)) $this->_login=$user;
                else $this->_login="anonymous";
                if(!is_null($pass)) $this->_password=$pass;
                else $this->_password="anon@anon.com";
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 mget has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function mget($remote, $local=".", $continious=false) {
                $list=$this->rawlist($remote, "-lA");
                if($list===false) {
                    $this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
                    return FALSE;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

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

              function get($remotefile, $localfile=NULL, $rest=0) {
                  if(is_null($localfile)) $localfile=$remotefile;
                  if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
                  $fp = @fopen($localfile, "w");
                  if (!$fp) {
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 put has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              function put($localfile, $remotefile=NULL, $rest=0) {
                  if(is_null($remotefile)) $remotefile=$localfile;
                  if (!file_exists($localfile)) {
                      $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
                      return FALSE;
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 glob_pattern_match has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              function glob_pattern_match($pattern,$string) {
                  $out=null;
                  $chunks=explode(';',$pattern);
                  foreach($chunks as $pattern) {
                      $escape=array('$','^','.','{','}','(',')','[',']','|');
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 put has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function put($localfile, $remotefile=NULL, $rest=0) {
                  if(is_null($remotefile)) $remotefile=$localfile;
                  if (!file_exists($localfile)) {
                      $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
                      return FALSE;
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

            Method get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function get($remotefile, $localfile=NULL, $rest=0) {
                    if(is_null($localfile)) $localfile=$remotefile;
                    if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
                    $fp = @fopen($localfile, "w");
                    if (!$fp) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

              Method mdel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function mdel($remote, $continious=false) {
                      $list=$this->rawlist($remote, "-la");
                      if($list===false) {
                          $this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
                          return false;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

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

                    function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) {
                        $this->LocalEcho=$le;
                        $this->Verbose=$verb;
                        $this->_lastaction=NULL;
                        $this->_error_array=array();
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

                  Method mput has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function mput($local=".", $remote=NULL, $continious=false) {
                          $local=realpath($local);
                          if(!@file_exists($local)) {
                              $this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\"");
                              return FALSE;
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

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

                        function connect($server=NULL) {
                            if(!empty($server)) {
                                if(!$this->SetServer($server)) return false;
                            }
                            if($this->_ready) return true;
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

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

                          function SetServer($host, $port=21, $reconnect=true) {
                              if(!is_long($port)) {
                                  $this->verbose=true;
                                  $this->SendMSG("Incorrect port syntax");
                                  return FALSE;
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 1 hr to fix

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

                            function _list($arg="", $cmd="LIST", $fnction="_list") {
                                if(!$this->_data_prepare()) return false;
                                if(!$this->_exec($cmd.$arg, $fnction)) {
                                    $this->_data_close();
                                    return FALSE;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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 fput has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function fput($remotefile, $fp) {
                                if($this->_can_restore and $rest!=0) fseek($fp, $rest);
                                $pi=pathinfo($remotefile);
                                if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
                                else $mode=FTP_BINARY;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 55 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 fget has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function fget($fp, $remotefile,$rest=0) {
                                if($this->_can_restore and $rest!=0) fseek($fp, $rest);
                                $pi=pathinfo($remotefile);
                                if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
                                else $mode=FTP_BINARY;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 55 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 dirlist has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function dirlist($remote) {
                                $list=$this->rawlist($remote, "-la");
                                if($list===false) {
                                    $this->PushError("dirlist","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
                                    return false;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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

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

                            function abort() {
                                if(!$this->_exec("ABOR", "abort")) return FALSE;
                                if(!$this->_checkCode()) {
                                    if($this->_code!=426) return FALSE;
                                    if(!$this->_readmsg("abort")) return FALSE;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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

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

                            function rename($from, $to) {
                                if(!$this->_exec("RNFR ".$from, "rename")) return FALSE;
                                if(!$this->_checkCode()) return FALSE;
                                if($this->_code==350) {
                                    if(!$this->_exec("RNTO ".$to, "rename")) return FALSE;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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

                        Avoid too many return statements within this method.
                        Open

                                return $out;
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  if(!$this->_checkCode()) return FALSE;
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        if(!$this->_checkCode()) return FALSE;
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return $ret;
                              Severity: Major
                              Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            if($out === FALSE ) return FALSE;
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return true;
                                  Severity: Major
                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            if(!$this->_readmsg()) return FALSE;
                                    Severity: Major
                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              if(!$this->_readmsg()) return FALSE;
                                      Severity: Major
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                if(empty($list)) return TRUE;
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return $out;
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        if(!$this->_checkCode()) return FALSE;
                                            Severity: Major
                                            Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                      if(!$this->_checkCode()) return FALSE;
                                              Severity: Major
                                              Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return FALSE;
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                          return TRUE;
                                                  Severity: Major
                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                            return TRUE;
                                                    Severity: Major
                                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return TRUE;
                                                      Severity: Major
                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return TRUE;
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  if(!$this->_checkCode()) return FALSE;
                                                          Severity: Major
                                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                    } else return FALSE;
                                                            Severity: Major
                                                            Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      if(!$this->_checkCode()) return FALSE;
                                                              Severity: Major
                                                              Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return $ret;
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                          return TRUE;
                                                                  Severity: Major
                                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                            return $ret;
                                                                    Severity: Major
                                                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                              return $out;
                                                                      Severity: Major
                                                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php - About 30 mins to fix

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

                                                                            function file_exists($pathname) {
                                                                                $exists=true;
                                                                                if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE;
                                                                                else {
                                                                                    if(!$this->_checkCode()) $exists=FALSE;
                                                                        Severity: Minor
                                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.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_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
                                                                                    $b = array();
                                                                                    if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
                                                                                    $b['isdir'] = ($lucifer[7]=="<DIR>");
                                                                                    if ( $b['isdir'] )
                                                                        Severity: Major
                                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php and 1 other location - About 5 days to fix
                                                                        Web.Admin/2014/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php on lines 266..321

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

                                                                        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

                                                                            function fget($fp, $remotefile,$rest=0) {
                                                                                if($this->_can_restore and $rest!=0) fseek($fp, $rest);
                                                                                $pi=pathinfo($remotefile);
                                                                                if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
                                                                                else $mode=FTP_BINARY;
                                                                        Severity: Major
                                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php and 1 other location - About 1 day to fix
                                                                        Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php on lines 586..608

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

                                                                        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

                                                                            function fput($remotefile, $fp) {
                                                                                if($this->_can_restore and $rest!=0) fseek($fp, $rest);
                                                                                $pi=pathinfo($remotefile);
                                                                                if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
                                                                                else $mode=FTP_BINARY;
                                                                        Severity: Major
                                                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php and 1 other location - About 1 day to fix
                                                                        Web.Admin/2014/wordpress/wp-admin/includes/class-ftp.php on lines 527..549

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

                                                                        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