CaffGeek/MBACNationals

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

Summary

Maintainability
B
6 hrs
Test Coverage

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

    function search_for_folder($folder, $base = '.', $loop = false ) {
        if ( empty( $base ) || '.' == $base )
            $base = trailingslashit($this->cwd());

        $folder = untrailingslashit($folder);

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

    function gethchmod($file){
        $perms = $this->getchmod($file);
        if (($perms & 0xC000) == 0xC000) // Socket
            $info = 's';
        elseif (($perms & 0xA000) == 0xA000) // Symbolic Link

    Function find_folder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        function find_folder($folder) {
    
            if ( strpos($this->method, 'ftp') !== false ) {
                $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR );
                foreach ( $constant_overrides as $constant => $dir )

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

        function gethchmod($file){
            $perms = $this->getchmod($file);
            if (($perms & 0xC000) == 0xC000) // Socket
                $info = 's';
            elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-wp-filesystem-base.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 $return;
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/class-wp-filesystem-base.php - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status