owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
        // Current synctoken
        $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
        $stmt->execute([ $addressBookId ]);
        $currentToken = $stmt->fetchColumn();
Severity: Minor
Found in apps/dav/lib/CardDAV/CardDavBackend.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 updateProperties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) {
        $cardId = $this->getCardId($addressBookId, $cardUri);
        $vCard = $this->readCard($vCardSerialized);

        $this->purgeProperties($addressBookId, $cardId);
Severity: Minor
Found in apps/dav/lib/CardDAV/CardDavBackend.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 update has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $id,
        $mountPoint,
        $backend,
        $authMechanism,
        $backendOptions,
Severity: Major
Found in apps/files_external/lib/Controller/GlobalStoragesController.php - About 1 hr to fix

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

        public function handlePut(RequestInterface $request, ResponseInterface $response) {
            if ($request->getHeader('OC-Autorename') !== '1') {
                return;
            }
    
    
    Severity: Minor
    Found in apps/dav/lib/Connector/Sabre/AutorenamePlugin.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 syncRemoteAddressBook has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function syncRemoteAddressBook($url, $userName, $sharedSecret, $syncToken, $targetBookId, $targetPrincipal, $targetProperties) {
            // 1. create addressbook
            $book = $this->ensureSystemAddressBookExists($targetPrincipal, $targetBookId, $targetProperties);
            $addressBookId = $book['id'];
    
    
    Severity: Minor
    Found in apps/dav/lib/CardDAV/SyncService.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 getFolderContents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getFolderContents($path) {
            $this->log('enter: '.__FUNCTION__."($path)");
            try {
                $path = $this->buildPath($path);
                $result = [];
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/SMB.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 copyRecursiveMetaDataFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function copyRecursiveMetaDataFiles(string $src, string $srcOwnerUid, string $dst, string $dstOwnerUid) {
            $absSrc = self::pathToAbsDiskPath($srcOwnerUid, $src);
            $absDst = self::pathToAbsDiskPath($dstOwnerUid, $dst);
    
            if (!\is_dir($absSrc)) {
    Severity: Minor
    Found in apps/files_versions/lib/MetaStorage.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 readHostKeys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function readHostKeys() {
            try {
                $keyPath = $this->hostKeysPath();
                if (\file_exists($keyPath)) {
                    $hosts = [];
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/SFTP.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 getQueryForFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getQueryForFilter($filter) {
            $user = $this->activityManager->getCurrentUserId();
            // Display actions from all files
            if ($filter === self::FILTER_FILES) {
                return ['`app` = ?', [self::APP_FILES]];
    Severity: Minor
    Found in apps/files/lib/Activity.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 publishActivity has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
    Severity: Major
    Found in lib/public/Activity/IManager.php - About 1 hr to fix

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

          public static function initSession() {
              // Let the session name be changed in the initSession Hook
              $sessionName = OC_Util::getInstanceId();
      
              try {
      Severity: Minor
      Found in lib/kernel.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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function index($dir = '', $view = '', $fileid = null, $details = null) {
              $fileNotFound = false;
              if ($fileid !== null) {
                  try {
                      return $this->showFile($fileid, $details);
      Severity: Minor
      Found in apps/files/lib/Controller/ViewController.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 showFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function showFile($fileId, $details = null) {
              $uid = $this->userSession->getUser()->getUID();
              $baseFolder = $this->rootFolder->get($uid . '/files/');
              '@phan-var \OCP\Files\Folder $baseFolder';
              $files = $baseFolder->getById($fileId);
      Severity: Minor
      Found in apps/files/lib/Controller/ViewController.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 addRecursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addRecursive($path, $source) {
              $dh = \opendir($source);
              if (\is_resource($dh)) {
                  $this->addFolder($path);
                  while (($file = \readdir($dh)) !== false) {
      Severity: Minor
      Found in lib/private/Archive/Archive.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 stream_open has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function stream_open($path, $mode, $options, &$opened_path) {
              switch ($mode[0]) {
                  case 'r':
                      if (!isset(self::$data[$path])) {
                          return false;
      Severity: Minor
      Found in lib/private/Files/Stream/StaticStream.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 fileExists has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fileExists($path) {
              $files = $this->getFiles();
              if ((\array_search($path, $files) !== false) or (\array_search($path . '/', $files) !== false)) {
                  return true;
              } else {
      Severity: Minor
      Found in lib/private/Archive/TAR.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 addUser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addUser($user) {
              if ($this->inGroup($user)) {
                  return;
              }
      
      
      Severity: Minor
      Found in lib/private/Group/Group.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 copyRecursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function copyRecursive($source, $target) {
              $dh = $this->opendir($source);
              $result = true;
              while ($file = \readdir($dh)) {
                  if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
      Severity: Minor
      Found in lib/private/Files/Storage/PolyFill/CopyDirectory.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 getFolder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFolder($path) {
              $files = $this->getFiles();
              $folderContent = [];
              $pathLength = \strlen($path);
              foreach ($files as $file) {
      Severity: Minor
      Found in lib/private/Archive/TAR.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 rmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function rmdir($path) {
              if (!$this->isDeletable($path)) {
                  return false;
              }
              try {
      Severity: Minor
      Found in lib/private/Files/Storage/Local.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

      Severity
      Category
      Status
      Source
      Language