owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function rename($path1, $path2) {
        $renameOk = false;
        $copyKeysOk = true;  // assume keys are copied, in case we deal with versions

        $isVersion = $this->isVersion($path2) || $this->isVersion($path1);
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 1 hr to fix

    Method doUpgrade has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function doUpgrade($currentVersion, $installedVersion) {
            // Stop update if the update is over several major versions
            $allowedPreviousVersions = $this->getAllowedPreviousVersions();
            if (!self::isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersions)) {
                throw new \Exception('Updates between multiple major versions and downgrades are unsupported.');
    Severity: Minor
    Found in lib/private/Updater.php - About 1 hr to fix

      Method generateHashes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function generateHashes(
              \RecursiveIteratorIterator $iterator,
              $path
          ) {
              $hashes = [];
      Severity: Minor
      Found in lib/private/IntegrityCheck/Checker.php - About 1 hr to fix

        Method fixThisShare has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function fixThisShare($groupShares, $subShares) {
                if (empty($subShares)) {
                    return false;
                }
        
        
        Severity: Minor
        Found in lib/private/Repair/RepairUnmergedShares.php - About 1 hr to fix

          Method analyzeLibraries has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function analyzeLibraries(array $dependencies) {
                  $missing = [];
                  if (!isset($dependencies['lib'])) {
                      return $missing;
                  }
          Severity: Minor
          Found in lib/private/App/DependencyAnalyzer.php - About 1 hr to fix

            Method decryptUsersFiles has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
                    $this->setupUserFS($uid);
                    $directories = [];
                    $directories[] = '/' . $uid . '/files';
            
            
            Severity: Minor
            Found in lib/private/Encryption/DecryptAll.php - About 1 hr to fix

              Method validateToken has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function validateToken($token, $user = null) {
                      try {
                          $dbToken = $this->tokenProvider->getToken($token);
                      } catch (InvalidTokenException $ex) {
                          $this->logger->debug(
              Severity: Minor
              Found in lib/private/User/Session.php - About 1 hr to fix

                Method execute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        $outputType = $input->getOption('output');
                        if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
                            $certificates = \array_map(function (ICertificate $certificate) {
                                return [
                Severity: Minor
                Found in core/Command/Security/ListCertificates.php - About 1 hr to fix

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

                      _triggerGroupEdit: function($td, isSubadminSelect) {
                          var $groupsListContainer = $td.find('.groupsListContainer');
                          var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group');
                          var user = UserList.getUID($td);
                          var checked = _.keys($td.data('groups')) || [];
                  Severity: Minor
                  Found in settings/js/users/users.js - 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 checkExistingFiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      checkExistingFiles: function (selection, callbacks) {
                          var self = this;
                          var fileList = this.fileList;
                          var conflicts = [];
                          // only keep non-conflicting uploads
                  Severity: Minor
                  Found in apps/files/js/file-upload.js - 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 parseQueryString has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      parseQueryString: function (queryString) {
                          var parts,
                              pos,
                              components,
                              result = {},
                  Severity: Minor
                  Found in core/js/js.js - 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 EventSource has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  OC.EventSource=function(src,data){
                      var dataStr='';
                      var name;
                      var joinChar;
                      this.typelessListeners=[];
                  Severity: Minor
                  Found in core/js/eventsource.js - 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 check has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function check($pathsToCheck) {
                          // If any of elements cannot be downloaded, prevent whole download
                          foreach ($pathsToCheck as $file) {
                              try {
                                  $info = $this->userFolder->get($file);
                  Severity: Minor
                  Found in apps/files_sharing/lib/ViewOnly.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 setupFromToken has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function setupFromToken($token, $relativePath = null, $password = null) {
                          \OC_User::setIncognitoMode(true);
                  
                          $linkItem = \OCP\Share::getShareByToken($token, !$password);
                          if ($linkItem === false || ($linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder')) {
                  Severity: Minor
                  Found in apps/files_sharing/lib/Helper.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function run($argument) {
                          $target = $argument['url'];
                          $source = $this->urlGenerator->getAbsoluteURL('/');
                          $source = \rtrim($source, '/');
                          $token = $argument['token'];
                  Severity: Minor
                  Found in apps/federation/lib/BackgroundJob/GetSharedSecret.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 discover has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function discover($remote) {
                          // Check if something is in the cache
                          if ($cacheData = $this->cache->get($remote)) {
                              return \json_decode($cacheData, true);
                          }
                  Severity: Minor
                  Found in apps/federatedfilesharing/lib/DiscoveryManager.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 firstLogin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function firstLogin(IUser $user = null) {
                          if ($user !== null) {
                              $principal = 'principals/users/' . $user->getUID();
                              $calendars = $this->calDav->getCalendarsForUser($principal);
                              if (empty($calendars) || (\count($calendars) === 1 && $calendars[0]['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI)) {
                  Severity: Minor
                  Found in apps/dav/lib/HookManager.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 verifyChecksumsForFolder has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function verifyChecksumsForFolder($folder, InputInterface $input, OutputInterface $output) {
                          $folderQueue = [$folder];
                          while ($currentFolder = \array_pop($folderQueue)) {
                              '@phan-var \OCP\Files\Folder $currentFolder';
                              $currentFolderPath = $currentFolder->getPath();
                  Severity: Minor
                  Found in apps/files/lib/Command/VerifyChecksums.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 checkDependencies has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function checkDependencies() {
                          $ret = [];
                  
                          $result = \call_user_func([$this->getStorageClass(), 'checkDependencies']);
                          if ($result !== true) {
                  Severity: Minor
                  Found in apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.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 writeExtra has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function writeExtra($app, $message, $level, $conditionalLogFile, $extraFields = []) {
                          $config = \OC::$server->getSystemConfig();
                  
                          // default to ISO8601
                          $format = $config->getValue('logdateformat', 'c');
                  Severity: Minor
                  Found in lib/private/Log/Owncloud.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