owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method put has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function put($data) {
        try {
            $exists = $this->fileView->file_exists($this->path);
            if ($this->info && $exists && !$this->info->isUpdateable()) {
                throw new Forbidden();
Severity: Major
Found in apps/dav/lib/Connector/Sabre/File.php - About 5 hrs to fix

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

                if (
                $.inArray(keyCodes.n, keys) !== -1 && ($.inArray(keyCodes.cmdFirefox, keys) !== -1 || $.inArray(keyCodes.cmdOpera, keys) !== -1 || $.inArray(keyCodes.leftCmdWebKit, keys) !== -1 || $.inArray(keyCodes.rightCmdWebKit, keys) !== -1 || $.inArray(keyCodes.ctrl, keys) !== -1 || event.ctrlKey)) {
                    if ($.inArray(keyCodes.shift, keys) !== -1) { //16=shift, New File
                        newFile();
                    } else { //New Folder
    Severity: Major
    Found in apps/files/js/keyboardshortcuts.js and 1 other location - About 5 hrs to fix
    apps/files/js/keyboardshortcuts.js on lines 136..139

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

    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 (
                $.inArray(keyCodes.n, keys) !== -1 && ($.inArray(keyCodes.cmdFirefox, keys) !== -1 || $.inArray(keyCodes.cmdOpera, keys) !== -1 || $.inArray(keyCodes.leftCmdWebKit, keys) !== -1 || $.inArray(keyCodes.rightCmdWebKit, keys) !== -1 || $.inArray(keyCodes.ctrl, keys) !== -1 || event.ctrlKey)) {
                    preventDefault = true; //new file/folder prevent browser from responding
                }
    Severity: Major
    Found in apps/files/js/keyboardshortcuts.js and 1 other location - About 5 hrs to fix
    apps/files/js/keyboardshortcuts.js on lines 148..165

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

    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

    Method install has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function install($options) {
            $l = $this->l10n;
    
            $error = [];
            $dbType = $options['dbtype'];
    Severity: Major
    Found in lib/private/Setup.php - About 5 hrs to fix

      File zh_TW.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      OC.L10N.register(
          "settings",
          {
          "Wrong current password" : "當前密碼錯誤",
          "The new password cannot be the same as the previous one" : "新密碼不能與上一個密碼重複.",
      Severity: Minor
      Found in settings/l10n/zh_TW.js - About 5 hrs to fix

        File Checker.php has 393 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @author Lukas Reschke <lukas@statuscode.ch>
         * @author Roeland Jago Douma <rullzer@owncloud.com>
         * @author Thomas Müller <thomas.mueller@tmit.eu>
        Severity: Minor
        Found in lib/private/IntegrityCheck/Checker.php - About 5 hrs to fix

          Function copyBetweenStorage has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              private function copyBetweenStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename) {
                  // for versions we have nothing to do, because versions should always use the
                  // key from the original file. Just create a 1:1 copy and done
                  if ($this->isVersion($targetInternalPath) ||
                      $this->isVersion($sourceInternalPath)) {
          Severity: Minor
          Found in lib/private/Files/Storage/Wrapper/Encryption.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

          Function checkReshare has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate) {
                  $backend = self::getBackend($itemType);
          
                  $l = \OC::$server->getL10N('lib');
                  $result = [];
          Severity: Minor
          Found in lib/private/Share/Share.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

          Function analyse has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              public function analyse($appId) {
                  $appPath = $this->appManager->getAppPath($appId);
                  if ($appPath === false) {
                      throw new \RuntimeException("No app with given id <$appId> known.");
                  }
          Severity: Minor
          Found in lib/private/App/CodeChecker/InfoChecker.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

          Function parse has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              public function parse($file) {
                  if (!\is_file($file)) {
                      throw new AppNotFoundException(
                          \sprintf('%s does not exist', $file)
                      );
          Severity: Minor
          Found in lib/private/App/InfoParser.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

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

                  davProperties: {
                      'meta-version-edited-by': OC.Files.Client.PROPERTY_VERSION_EDITED_BY,
                      'meta-version-edited-by-name': OC.Files.Client.PROPERTY_VERSION_EDITED_BY_NAME,
                      'meta-version-tag':    OC.Files.Client.PROPERTY_VERSION_TAG,
                      'id': OC.Files.Client.PROPERTY_FILEID,
          Severity: Major
          Found in apps/files_versions/js/versioncollection.js and 1 other location - About 5 hrs to fix
          apps/files_versions/js/versionsrootmodel.js on lines 30..39

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

          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

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

                  davProperties: {
                      'meta-version-edited-by': OC.Files.Client.PROPERTY_VERSION_EDITED_BY,
                      'meta-version-edited-by-name': OC.Files.Client.PROPERTY_VERSION_EDITED_BY_NAME,
                      'meta-version-tag':    OC.Files.Client.PROPERTY_VERSION_TAG,
                      'id':    OC.Files.Client.PROPERTY_FILEID,
          Severity: Major
          Found in apps/files_versions/js/versionsrootmodel.js and 1 other location - About 5 hrs to fix
          apps/files_versions/js/versioncollection.js on lines 30..39

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

          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

          Node has 40 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Node implements \OCP\Files\Node {
              /**
               * @var \OC\Files\View $view
               */
              protected $view;
          Severity: Minor
          Found in lib/private/Files/Node/Node.php - About 5 hrs to fix

            Method processNotification has 133 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function processNotification(
                    $notificationType,
                    $resourceType,
                    $providerId,
                    $notification
            Severity: Major
            Found in apps/federatedfilesharing/lib/Controller/OcmController.php - About 5 hrs to fix

              Method setPermissions has 133 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
                      $l = \OC::$server->getL10N('lib');
                      $connection = \OC::$server->getDatabaseConnection();
              
                      $intArrayToLiteralArray = function ($intArray, $eb) {
              Severity: Major
              Found in lib/private/Share/Share.php - About 5 hrs to fix

                File gl.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                OC.L10N.register(
                    "settings",
                    {
                    "Wrong current password" : "O contrasinal actual é incorrecto",
                    "The new password cannot be the same as the previous one" : "O novo contrasinal non pode ser o mesmo que o anterior",
                Severity: Minor
                Found in settings/l10n/gl.js - About 5 hrs to fix

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

                  <?php
                  /**
                   * @author Vincent Petry <pvince81@owncloud.com>
                   *
                   * @copyright Copyright (c) 2018, ownCloud GmbH
                  Severity: Major
                  Found in lib/private/Files/Mount/PreviewsMountProvider.php and 1 other location - About 5 hrs to fix
                  lib/private/Files/Mount/CacheMountProvider.php on lines 1..69

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

                  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

                  <?php
                  /**
                   * @author Robin Appelman <icewind@owncloud.com>
                   *
                   * @copyright Copyright (c) 2018, ownCloud GmbH
                  Severity: Major
                  Found in lib/private/Files/Mount/CacheMountProvider.php and 1 other location - About 5 hrs to fix
                  lib/private/Files/Mount/PreviewsMountProvider.php on lines 1..69

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

                  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

                  File he.js has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  OC.L10N.register(
                      "settings",
                      {
                      "Wrong current password" : "סיסמא נוכחית שגויה",
                      "The new password cannot be the same as the previous one" : "הסיסמא החדשה אינה יכולה להיות זהה לסיסמא הקודמת",
                  Severity: Minor
                  Found in settings/l10n/he.js - About 5 hrs to fix

                    Function restoreVersionsFromTrashbin has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function restoreVersionsFromTrashbin(View $view, $filename, $targetLocation) {
                            if (\OCP\App::isEnabled('files_versions')) {
                                $user = User::getUser();
                                $rootView = new View('/');
                    
                    
                    Severity: Minor
                    Found in apps/files_trashbin/lib/Trashbin.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

                    Severity
                    Category
                    Status
                    Source
                    Language