owncloud/core

View on GitHub
lib/private/Files/Filesystem.php

Summary

Maintainability
F
3 days
Test Coverage

Filesystem has 71 functions (exceeds 20 allowed). Consider refactoring.
Open

class Filesystem {
    /**
     * @var Mount\Manager $mounts
     */
    private static $mounts;
Severity: Major
Found in lib/private/Files/Filesystem.php - About 1 day to fix

    File Filesystem.php has 530 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
     * @author Bart Visscher <bartv@thisnet.nl>
     * @author Christopher Schäpers <kondou@ts.unde.re>
    Severity: Major
    Found in lib/private/Files/Filesystem.php - About 1 day to fix

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

          private static function checkRegexAgainstFolderOrFile($regexList, $path, $callerMessage = '') {
              foreach ($regexList as $item) {
                  // check if the first and last character is a '/' and add one if not
                  // terminate with i == case insensitive
                  $newItem = $item;
      Severity: Minor
      Found in lib/private/Files/Filesystem.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 isForbiddenFileOrDir has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
              $blacklistArray = [];
              $pathParts = [];
      
              // force blacklist/exclude arraylist/arrayRegex for unit tests
      Severity: Major
      Found in lib/private/Files/Filesystem.php - About 2 hrs to fix

        Method initMountPoints has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function initMountPoints($user = '', $fullInit = true) {
                if ($user == '') {
                    $user = \OC_User::getUser();
                }
                if ($user === null || $user === false || $user === '') {
        Severity: Minor
        Found in lib/private/Files/Filesystem.php - About 1 hr to fix

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

              public static function initMountPoints($user = '', $fullInit = true) {
                  if ($user == '') {
                      $user = \OC_User::getUser();
                  }
                  if ($user === null || $user === false || $user === '') {
          Severity: Minor
          Found in lib/private/Files/Filesystem.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 normalizePath has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
                  if (self::$normalizedPathCache === null) {
                      self::$normalizedPathCache = new CappedMemoryCache();
                  }
          
          
          Severity: Minor
          Found in lib/private/Files/Filesystem.php - About 1 hr to fix

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

                public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
                    if (self::$normalizedPathCache === null) {
                        self::$normalizedPathCache = new CappedMemoryCache();
                    }
            
            
            Severity: Minor
            Found in lib/private/Files/Filesystem.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 isForbiddenFileOrDir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
                    $blacklistArray = [];
                    $pathParts = [];
            
                    // force blacklist/exclude arraylist/arrayRegex for unit tests
            Severity: Minor
            Found in lib/private/Files/Filesystem.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

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in lib/private/Files/Filesystem.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status