owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    public function setUserConfig() {
        $acceptedKeys = [];
        $rejectedKeys = [];

        $params = $this->getUserRequestParams();
apps/federatedfilesharing/lib/Controller/SharingPersonalSettingsController.php on lines 54..80

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

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 createItem has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function createItem(element, checked){
                element=$(element);
                var item=element.val();
                var id='ms'+multiSelectId+'-option-'+item;
                var input=$('<input type="' + inputType + '"/>');
Severity: Major
Found in core/js/multiselect.js - About 3 hrs to fix

    Method formatShare has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function formatShare(IShare $share, $received = false) {
            $sharedBy = $this->userManager->get($share->getSharedBy());
            $shareFileOwner = $this->userManager->get($share->getShareOwner());
    
            $result = [
    Severity: Major
    Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 3 hrs to fix

      Method copy has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function copy($path1, $path2, $preserveMtime = false) {
              $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1));
              $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2));
              return $this->emittingCall(function () use ($absolutePath1, $absolutePath2) {
                  $result = false;
      Severity: Major
      Found in lib/private/Files/View.php - About 3 hrs to fix

        Method analyse has 87 lines of code (exceeds 25 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: Major
        Found in lib/private/App/CodeChecker/InfoChecker.php - About 3 hrs to fix

          File Activity.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @author Joas Schilling <coding@schilljs.com>
           * @author Morris Jobke <hey@morrisjobke.de>
           * @author Thomas Müller <thomas.mueller@tmit.eu>
          Severity: Minor
          Found in apps/files/lib/Activity.php - About 3 hrs to fix

            Function add has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            add: function(e, data) {
                                self.log('add', e, data);
                                var that = $(this), freeSpace;
            
                                var upload = new OC.FileUpload(self, data);
            Severity: Major
            Found in apps/files/js/file-upload.js - About 3 hrs to fix

              Method get has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function get($dir, $files, $params = null) {
                      $view = \OC\Files\Filesystem::getView();
              
                      if (!\is_array($files)) {
                          // "files" contains a string with a filename
              Severity: Major
              Found in lib/private/legacy/files.php - About 3 hrs to fix

                Function getNodeForPath has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getNodeForPath($path) {
                        if (!$this->fileView) {
                            throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
                        }
                
                
                Severity: Minor
                Found in apps/dav/lib/Connector/Sabre/ObjectTree.php - About 3 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 rename has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function rename($source, $target) {
                        $this->log("enter: rename('$source', '$target')", Util::DEBUG);
                
                        if ($this->isRootDir($source) || $this->isRootDir($target)) {
                            $this->log("refusing to rename \"$source\" to \"$target\"");
                Severity: Minor
                Found in apps/files_external/lib/Lib/Storage/SMB.php - About 3 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 verify has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function verify($signaturePath, $basePath, $certificateCN, $force = false) {
                        if (!$force && !$this->isCodeCheckEnforced()) {
                            return [];
                        }
                
                
                Severity: Minor
                Found in lib/private/IntegrityCheck/Checker.php - About 3 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 getIdsForTag has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getIdsForTag($tag) {
                        $result = null;
                        $tagId = false;
                        if (\is_numeric($tag)) {
                            $tagId = $tag;
                Severity: Minor
                Found in lib/private/Tags.php - About 3 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 fixOrientation has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function fixOrientation() {
                        $o = $this->getOrientation();
                        $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']);
                        $rotate = 0;
                        $flip = false;
                Severity: Minor
                Found in lib/private/legacy/image.php - About 3 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 loadFromFile has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function loadFromFile($imagePath = false) {
                        // exif_imagetype throws "read error!" if file is less than 12 byte
                        if (!@\is_file($imagePath) || !\file_exists($imagePath) || \filesize($imagePath) < 12 || !\is_readable($imagePath)) {
                            return false;
                        }
                Severity: Minor
                Found in lib/private/legacy/image.php - About 3 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 loadIndex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function loadIndex($table, $xml) {
                        $name = null;
                        $fields = [];
                        foreach ($xml->children() as $child) {
                            /**
                Severity: Minor
                Found in lib/private/DB/MDB2SchemaReader.php - About 3 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 gc has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function gc() {
                        $storage = $this->getStorage();
                        if ($storage and $storage->is_dir('/')) {
                            // extra hour safety, in case of stray part chunks that take longer to write,
                            // because touch() is only called after the chunk was finished
                Severity: Minor
                Found in lib/private/Cache/File.php - About 3 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 filepicker has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    filepicker:function(title, callback, multiselect, mimetypeFilter, modal) {
                        var self = this;
                        // avoid opening the picker twice
                        if (this.filepicker.loading) {
                            return;
                Severity: Major
                Found in core/js/oc-dialogs.js - About 3 hrs to fix

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

                  OC.L10N.register(
                      "core",
                      {
                      "Please select a file." : "Tulung milih berkas.",
                      "File is too big" : "Berkas kegedhen",
                  Severity: Major
                  Found in core/l10n/jv.js and 5 other locations - About 3 hrs to fix
                  apps/comments/l10n/et_EE.js on lines 1..22
                  apps/federatedfilesharing/l10n/mk.js on lines 1..22
                  apps/files_external/l10n/de_AT.js on lines 1..22
                  lib/l10n/kn.js on lines 1..22
                  lib/l10n/sr@latin.js on lines 1..22

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

                  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 6 locations. Consider refactoring.
                  Open

                  OC.L10N.register(
                      "comments",
                      {
                      "Type in a new comment..." : "Kirjuta uus komentaar...",
                      "Delete comment" : "Kustuta kommentaar",
                  Severity: Major
                  Found in apps/comments/l10n/et_EE.js and 5 other locations - About 3 hrs to fix
                  apps/federatedfilesharing/l10n/mk.js on lines 1..22
                  apps/files_external/l10n/de_AT.js on lines 1..22
                  core/l10n/jv.js on lines 1..22
                  lib/l10n/kn.js on lines 1..22
                  lib/l10n/sr@latin.js on lines 1..22

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

                  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 6 locations. Consider refactoring.
                  Open

                  OC.L10N.register(
                      "lib",
                      {
                      "Unknown filetype" : "ಅಪರಿಚಿತ ಕಡತ ಮಾದರಿ",
                      "Invalid image" : "ಅಸಾಮರ್ಥ್ಯ ಚಿತ್ರ",
                  Severity: Major
                  Found in lib/l10n/kn.js and 5 other locations - About 3 hrs to fix
                  apps/comments/l10n/et_EE.js on lines 1..22
                  apps/federatedfilesharing/l10n/mk.js on lines 1..22
                  apps/files_external/l10n/de_AT.js on lines 1..22
                  core/l10n/jv.js on lines 1..22
                  lib/l10n/sr@latin.js on lines 1..22

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language