owncloud/core

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

Summary

Maintainability
F
2 wks
Test Coverage

File View.php has 1478 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
 * @author Bart Visscher <bartv@thisnet.nl>
 * @author Björn Schießle <bjoern@schiessle.org>
Severity: Major
Found in lib/private/Files/View.php - About 3 days to fix

    Function getDirectoryContent has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDirectoryContent($directory, $mimetype_filter = '') {
            $this->assertPathLength($directory);
            if (!Filesystem::isValidPath($directory)) {
                return [];
            }
    Severity: Minor
    Found in lib/private/Files/View.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

    View has 85 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class View {
        use EventEmitterTrait;
        /** @var string */
        private $fakeRoot = '';
    
    
    Severity: Major
    Found in lib/private/Files/View.php - About 1 day to fix

      Function basicOperation has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

          private function basicOperation($operation, $path, $hooks = [], $extraParam = null) {
              $postFix = (\substr($path, -1, 1) === '/') ? '/' : '';
              $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
              if (Filesystem::isValidPath($path)
                  and !Filesystem::isForbiddenFileOrDir($path)
      Severity: Minor
      Found in lib/private/Files/View.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

      Function getFileInfo has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFileInfo($path, $includeMountPoints = true) {
              $this->assertPathLength($path);
              if (!Filesystem::isValidPath($path)) {
                  return false;
              }
      Severity: Minor
      Found in lib/private/Files/View.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 getDirectoryContent has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDirectoryContent($directory, $mimetype_filter = '') {
              $this->assertPathLength($directory);
              if (!Filesystem::isValidPath($directory)) {
                  return [];
              }
      Severity: Major
      Found in lib/private/Files/View.php - About 4 hrs to fix

        Method rename has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function rename($path1, $path2) {
                return $this->emittingCall(function () use (&$path1, &$path2) {
                    $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
                    $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
                    $result = false;
        Severity: Major
        Found in lib/private/Files/View.php - About 4 hrs to fix

          Method copy has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function copy($path1, $path2, $preserveMtime = false) {
                  $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
                  $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
                  return $this->emittingCall(function () use ($absolutePath1, $absolutePath2) {
                      $result = false;
          Severity: Major
          Found in lib/private/Files/View.php - About 3 hrs to fix

            Method basicOperation has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function basicOperation($operation, $path, $hooks = [], $extraParam = null) {
                    $postFix = (\substr($path, -1, 1) === '/') ? '/' : '';
                    $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
                    if (Filesystem::isValidPath($path)
                        and !Filesystem::isForbiddenFileOrDir($path)
            Severity: Major
            Found in lib/private/Files/View.php - About 2 hrs to fix

              Function searchCommon has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function searchCommon($method, $args) {
                      $files = [];
                      $rootLength = \strlen($this->fakeRoot);
              
                      $mount = $this->getMount('');
              Severity: Minor
              Found in lib/private/Files/View.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 getFileInfo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getFileInfo($path, $includeMountPoints = true) {
                      $this->assertPathLength($path);
                      if (!Filesystem::isValidPath($path)) {
                          return false;
                      }
              Severity: Major
              Found in lib/private/Files/View.php - About 2 hrs to fix

                Function emit_file_hooks_pre has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function emit_file_hooks_pre($exists, $path, &$run) {
                        $event = new GenericEvent(null);
                        if (!$exists) {
                            \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
                                Filesystem::signal_param_path => $this->getHookPath($path),
                Severity: Minor
                Found in lib/private/Files/View.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 getPath has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPath($id, $includeShares = true) {
                        $id = (int)$id;
                        $manager = Filesystem::getMountManager();
                        $mounts = $manager->findIn($this->fakeRoot);
                        $findResult = $manager->find($this->fakeRoot);
                Severity: Minor
                Found in lib/private/Files/View.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 file_put_contents has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function file_put_contents($path, $data) {
                        return $this->emittingCall(function () use (&$path, &$data) {
                            if (\is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier
                                $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
                                if (Filesystem::isValidPath($path)
                Severity: Minor
                Found in lib/private/Files/View.php - About 1 hr to fix

                  Function fromTmpFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function fromTmpFile($tmpFile, $path) {
                          $this->assertPathLength($path);
                          if (Filesystem::isValidPath($path)) {
                              // Get directory that the file is going into
                              $filePath = \dirname($path);
                  Severity: Minor
                  Found in lib/private/Files/View.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 searchCommon has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function searchCommon($method, $args) {
                          $files = [];
                          $rootLength = \strlen($this->fakeRoot);
                  
                          $mount = $this->getMount('');
                  Severity: Minor
                  Found in lib/private/Files/View.php - About 1 hr to fix

                    Method emit_file_hooks_pre has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function emit_file_hooks_pre($exists, $path, &$run) {
                            $event = new GenericEvent(null);
                            if (!$exists) {
                                \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
                                    Filesystem::signal_param_path => $this->getHookPath($path),
                    Severity: Minor
                    Found in lib/private/Files/View.php - About 1 hr to fix

                      Method verifyPath has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function verifyPath($path, $fileName) {
                              $l10n = \OC::$server->getL10N('lib');
                      
                              // verify empty and dot files
                              $trimmed = \trim($fileName);
                      Severity: Minor
                      Found in lib/private/Files/View.php - About 1 hr to fix

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

                            public function readfilePart($path, $from, $to) {
                                $this->assertPathLength($path);
                                @\ob_end_clean();
                                $handle = $this->fopen($path, 'rb');
                                if ($handle) {
                        Severity: Minor
                        Found in lib/private/Files/View.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 runHooks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function runHooks($hooks, $path, $post = false) {
                                if (empty($hooks)) {
                                    return true;
                                }
                                $relativePath = $path;
                        Severity: Minor
                        Found in lib/private/Files/View.php - About 1 hr to fix

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

                              public function fopen($path, $mode) {
                                  $hooks = [];
                                  switch ($mode) {
                                      case 'r':
                                      case 'rb':
                          Severity: Minor
                          Found in lib/private/Files/View.php - About 1 hr to fix

                            Method getCacheEntry has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getCacheEntry($storage, $internalPath, $relativePath) {
                                    $cache = $storage->getCache($internalPath);
                                    $data = $cache->get($internalPath);
                                    $watcher = $storage->getWatcher($internalPath);
                            
                            
                            Severity: Minor
                            Found in lib/private/Files/View.php - About 1 hr to fix

                              Function verifyPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function verifyPath($path, $fileName) {
                                      $l10n = \OC::$server->getL10N('lib');
                              
                                      // verify empty and dot files
                                      $trimmed = \trim($fileName);
                              Severity: Minor
                              Found in lib/private/Files/View.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 getCacheEntry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function getCacheEntry($storage, $internalPath, $relativePath) {
                                      $cache = $storage->getCache($internalPath);
                                      $data = $cache->get($internalPath);
                                      $watcher = $storage->getWatcher($internalPath);
                              
                              
                              Severity: Minor
                              Found in lib/private/Files/View.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 runHooks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function runHooks($hooks, $path, $post = false) {
                                      if (empty($hooks)) {
                                          return true;
                                      }
                                      $relativePath = $path;
                              Severity: Minor
                              Found in lib/private/Files/View.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 deeply nested control flow statements.
                              Open

                                                          if ($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage) {
                                                              continue;
                                                          }
                              Severity: Major
                              Found in lib/private/Files/View.php - About 45 mins to fix

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

                                    public function getRelativePath($path) {
                                        $this->assertPathLength($path);
                                        if ($this->fakeRoot == '') {
                                            return $path;
                                        }
                                Severity: Minor
                                Found in lib/private/Files/View.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

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

                                    public function hash($type, $path, $raw = false) {
                                        $postFix = (\substr($path, -1, 1) === '/') ? '/' : '';
                                        $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
                                        if (Filesystem::isValidPath($path)) {
                                            $path = $this->getRelativePath($absolutePath);
                                Severity: Minor
                                Found in lib/private/Files/View.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

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

                                    public function touch($path, $mtime = null) {
                                        if ($mtime !== null and !\is_numeric($mtime)) {
                                            $mtime = \strtotime($mtime);
                                        }
                                
                                
                                Severity: Minor
                                Found in lib/private/Files/View.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 $file->getMimetype() === $mimetype_filter;
                                Severity: Major
                                Found in lib/private/Files/View.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return $path;
                                  Severity: Major
                                  Found in lib/private/Files/View.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return (\strlen($fullPath) > \strlen($defaultRoot)) && (\substr($fullPath, 0, \strlen($defaultRoot) + 1) === $defaultRoot . '/');
                                    Severity: Major
                                    Found in lib/private/Files/View.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

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

                                        Avoid too many return statements within this method.
                                        Open

                                                    return [];
                                        Severity: Major
                                        Found in lib/private/Files/View.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return $info;
                                          Severity: Major
                                          Found in lib/private/Files/View.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                    return $file->getMimePart() === $mimetype_filter;
                                            Severity: Major
                                            Found in lib/private/Files/View.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return $files;
                                              Severity: Major
                                              Found in lib/private/Files/View.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

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

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

                                                      private function lockPath($path, $type, $lockMountPoint = false) {
                                                          $absolutePath = $this->getAbsolutePath($path);
                                                          $absolutePath = Filesystem::normalizePath($absolutePath);
                                                          if (!$this->shouldLockFile($absolutePath)) {
                                                              return false;
                                                  Severity: Minor
                                                  Found in lib/private/Files/View.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

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

                                                      public function changeLock($path, $type, $lockMountPoint = false) {
                                                          $path = Filesystem::normalizePath($path);
                                                          $absolutePath = $this->getAbsolutePath($path);
                                                          $absolutePath = Filesystem::normalizePath($absolutePath);
                                                          if (!$this->shouldLockFile($absolutePath)) {
                                                  Severity: Minor
                                                  Found in lib/private/Files/View.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

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

                                                      private function shouldEmitHooks($path = '') {
                                                          if ($path && Cache\Scanner::isPartialFile($path)) {
                                                              return false;
                                                          }
                                                          if (!Filesystem::$loaded) {
                                                  Severity: Minor
                                                  Found in lib/private/Files/View.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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                      public function lockFile($path, $type, $lockMountPoint = false) {
                                                          $absolutePath = $this->getAbsolutePath($path);
                                                          $absolutePath = Filesystem::normalizePath($absolutePath);
                                                          if (!$this->shouldLockFile($absolutePath)) {
                                                              return false;
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 2 hrs to fix
                                                  lib/private/Files/View.php on lines 2169..2184

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

                                                  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

                                                      public function unlockFile($path, $type, $lockMountPoint = false) {
                                                          $absolutePath = $this->getAbsolutePath($path);
                                                          $absolutePath = Filesystem::normalizePath($absolutePath);
                                                          if (!$this->shouldLockFile($absolutePath)) {
                                                              return false;
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 2 hrs to fix
                                                  lib/private/Files/View.php on lines 2143..2158

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

                                                  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

                                                          } else {
                                                              \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, [
                                                                  Filesystem::signal_param_path => $this->getHookPath($path),
                                                                  Filesystem::signal_param_run => &$run,
                                                              ]);
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 1 hr to fix
                                                  lib/private/Files/View.php on lines 635..659

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

                                                  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

                                                          if (!$exists) {
                                                              \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
                                                                  Filesystem::signal_param_path => $this->getHookPath($path),
                                                                  Filesystem::signal_param_run => &$run,
                                                              ]);
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 1 hr to fix
                                                  lib/private/Files/View.php on lines 647..659

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

                                                  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

                                                      public function getLocalFolder($path) {
                                                          $parent = \substr($path, 0, \strrpos($path, '/'));
                                                          $path = $this->getAbsolutePath($path);
                                                          list($storage, $internalPath) = Filesystem::resolvePath($path);
                                                          if (Filesystem::isValidPath($parent) and $storage) {
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 1 hr to fix
                                                  lib/private/Files/View.php on lines 247..256

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

                                                  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

                                                      public function getLocalFile($path) {
                                                          $parent = \substr($path, 0, \strrpos($path, '/'));
                                                          $path = $this->getAbsolutePath($path);
                                                          list($storage, $internalPath) = Filesystem::resolvePath($path);
                                                          if (Filesystem::isValidPath($parent) and $storage) {
                                                  Severity: Major
                                                  Found in lib/private/Files/View.php and 1 other location - About 1 hr to fix
                                                  lib/private/Files/View.php on lines 262..271

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

                                                  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