owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.extend = jQuery.fn.extend = function() {
    var options, name, src, copy, copyIsArray, clone,
        target = arguments[0] || {},
        i = 1,
        length = arguments.length,
Severity: Minor
Found in core/js/js.js - About 1 hr to fix

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

        private function buildSuperShares(array $allShares, \OCP\IUser $user) {
            $result = [];
    
            $groupedShares = $this->groupShares($allShares);
    
    
    Severity: Minor
    Found in apps/files_sharing/lib/MountProvider.php - About 1 hr to fix

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

          public function getShares($includingPending = false) {
              $shares = [];
              $groupExternalManager = null;
      
              foreach ($this->externalManager->getAcceptedShares() as $shareInfo) {
      Severity: Minor
      Found in apps/files_sharing/lib/Controller/RemoteOcsController.php - About 1 hr to fix

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

            public function fopen($path, $mode) {
                if ($source = $this->getSourcePath($path)) {
                    switch ($mode) {
                        case 'r+':
                        case 'rb+':
        Severity: Minor
        Found in apps/files_sharing/lib/SharedStorage.php - About 1 hr to fix

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

              public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) {
                  $data = [
                      'shareWith' => $shareWith,
                      'senderId' => $shareId
                  ];
          Severity: Minor
          Found in apps/federatedfilesharing/lib/Notifications.php - About 1 hr to fix

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

                public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
                    // Current synctoken
                    $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
                    $stmt->execute([ $calendarId ]);
                    $currentToken = $stmt->fetchColumn(0);
            Severity: Minor
            Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

              Method getChangesForAddressBook has 40 lines of code (exceeds 25 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

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

                    private static function printUpgradePage() {
                        $systemConfig = \OC::$server->getSystemConfig();
                
                        $disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
                        $tooBig = false;
                Severity: Minor
                Found in lib/kernel.php - About 1 hr to fix

                  Method stream_open has 40 lines of code (exceeds 25 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

                    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

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

                                    OC.L10N.register(
                                        "files_versions",
                                        {
                                        "Versions" : "Versões",
                                        "File {file} has been reverted and marked as new current version" : "O arquivo {file} foi revertido e marcado como a nova versão atual",
                                    Severity: Major
                                    Found in apps/files_versions/l10n/pt_BR.js and 1 other location - About 1 hr to fix
                                    apps/files_versions/l10n/es.js on lines 1..14

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

                                    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

                                    OC.L10N.register(
                                        "files_versions",
                                        {
                                        "Versions" : "Revisiones",
                                        "File {file} has been reverted and marked as new current version" : "El archivo {file} se ha revertido y se ha marcado como nueva versión actual",
                                    Severity: Major
                                    Found in apps/files_versions/l10n/es.js and 1 other location - About 1 hr to fix
                                    apps/files_versions/l10n/pt_BR.js on lines 1..14

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

                                    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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language