owncloud/core

View on GitHub
apps/dav/lib/Connector/Sabre/Directory.php

Summary

Maintainability
D
2 days
Test Coverage

Function moveInto has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
        if (!$sourceNode instanceof Node) {
            if ($sourceNode instanceof ITrashBinNode) {
                if (!$this->fileView->isCreatable($this->getPath())) {
                    throw new SabreForbidden('Destination directory is not writable');
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.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

File Directory.php has 295 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: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.php - About 3 hrs to fix

    Method moveInto has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
            if (!$sourceNode instanceof Node) {
                if ($sourceNode instanceof ITrashBinNode) {
                    if (!$this->fileView->isCreatable($this->getPath())) {
                        throw new SabreForbidden('Destination directory is not writable');
    Severity: Major
    Found in apps/dav/lib/Connector/Sabre/Directory.php - About 2 hrs to fix

      Function createFile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createFile($name, $data = null) {
              # the check here is necessary, because createFile uses put covered in sabre/file.php
              # and not touch covered in files/view.php
              if (Filesystem::isForbiddenFileOrDir($name)) {
                  throw new SabreForbidden();
      Severity: Minor
      Found in apps/dav/lib/Connector/Sabre/Directory.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 createFile has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createFile($name, $data = null) {
              # the check here is necessary, because createFile uses put covered in sabre/file.php
              # and not touch covered in files/view.php
              if (Filesystem::isForbiddenFileOrDir($name)) {
                  throw new SabreForbidden();
      Severity: Minor
      Found in apps/dav/lib/Connector/Sabre/Directory.php - About 2 hrs to fix

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

            public function getChild($name, $info = null) {
                if (!$this->info->isReadable()) {
                    // avoid detecting files through this way
                    throw new SabreNotFound();
                }
        Severity: Minor
        Found in apps/dav/lib/Connector/Sabre/Directory.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 createDirectory has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createDirectory($name) {
                # the check here is necessary, because createDirectory does not use the methods in files/view.php
                if (Filesystem::isForbiddenFileOrDir($name)) {
                    throw new SabreForbidden();
                }
        Severity: Minor
        Found in apps/dav/lib/Connector/Sabre/Directory.php - About 1 hr to fix

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

              public function getChild($name, $info = null) {
                  if (!$this->info->isReadable()) {
                      // avoid detecting files through this way
                      throw new SabreNotFound();
                  }
          Severity: Minor
          Found in apps/dav/lib/Connector/Sabre/Directory.php - About 1 hr to fix

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

                public function createDirectory($name) {
                    # the check here is necessary, because createDirectory does not use the methods in files/view.php
                    if (Filesystem::isForbiddenFileOrDir($name)) {
                        throw new SabreForbidden();
                    }
            Severity: Minor
            Found in apps/dav/lib/Connector/Sabre/Directory.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function delete() {
                    if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
                        throw new SabreForbidden();
                    }
            
            
            Severity: Minor
            Found in apps/dav/lib/Connector/Sabre/Directory.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

            There are no issues that match your filters.

            Category
            Status