CaffGeek/MBACNationals

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

Summary

Maintainability
C
1 day
Test Coverage

WP_Filesystem_ftpsockets has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
    var $ftp = false;
    var $errors = null;
    var $options = array();

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

        function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
            if ( $this->is_file($path) ) {
                $limit_file = basename($path);
                $path = dirname($path) . '/';
            } else {

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

        function WP_Filesystem_ftpsockets($opt = '') {
            $this->method = 'ftpsockets';
            $this->errors = new WP_Error();
    
            //Check if possible to use ftp functions.

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

        function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
            if ( $this->is_file($path) ) {
                $limit_file = basename($path);
                $path = dirname($path) . '/';
            } else {

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

          function chmod($file, $mode = false, $recursive = false ) {
      
              if ( ! $mode ) {
                  if ( $this->is_file($file) )
                      $mode = FS_CHMOD_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

      Avoid too many return statements within this method.
      Open

              return true;

        There are no issues that match your filters.

        Category
        Status