owncloud/core

View on GitHub
core/js/files/client.js

Summary

Maintainability
F
5 days
Test Coverage

File client.js has 583 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2015
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
Severity: Major
Found in core/js/files/client.js - About 1 day to fix

    Function _parseFileInfo has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _parseFileInfo: function(response) {
                var path = this._extractPath(response.href);
                // invalid subpath
                if (path === null) {
                    return null;
    Severity: Major
    Found in core/js/files/client.js - About 3 hrs to fix

      Function getFilteredFiles has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getFilteredFiles: function(filter, options) {
                  options = options || {};
                  var self = this;
                  var deferred = $.Deferred();
                  var promise = deferred.promise();
      Severity: Minor
      Found in core/js/files/client.js - About 1 hr to fix

        Function _moveOrCopy has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _moveOrCopy: function(operation, path, destinationPath, allowOverwrite, headers, options) {
                    if (!path) {
                        throw 'Missing argument "path"';
                    }
                    if (!destinationPath) {
        Severity: Minor
        Found in core/js/files/client.js - About 1 hr to fix

          Function putFileContents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  putFileContents: function(path, body, options) {
                      if (!path) {
                          throw 'Missing argument "path"';
                      }
                      var self = this;
          Severity: Minor
          Found in core/js/files/client.js - About 1 hr to fix

            Function Client has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var Client = function(options) {
                    this._root = options.root;
                    if (this._root.charAt(this._root.length - 1) === '/') {
                        this._root = this._root.substr(0, this._root.length - 1);
                    }
            Severity: Minor
            Found in core/js/files/client.js - About 1 hr to fix

              Function lock has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      lock: function(path, options) {
                          if (!path) {
                              throw 'Missing argument "path"';
                          }
                          var self = this;
              Severity: Minor
              Found in core/js/files/client.js - About 1 hr to fix

                Function getFolderContents has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        getFolderContents: function(path, options) {
                            if (!path) {
                                path = '';
                            }
                            options = options || {};
                Severity: Minor
                Found in core/js/files/client.js - About 1 hr to fix

                  Function unlock has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          unlock: function(path, token, options) {
                              if (!path) {
                                  throw 'Missing argument "path"';
                              }
                              if (!token) {
                  Severity: Minor
                  Found in core/js/files/client.js - About 1 hr to fix

                    Function getFileInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            getFileInfo: function(path, options) {
                                if (!path) {
                                    path = '';
                                }
                                options = options || {};
                    Severity: Minor
                    Found in core/js/files/client.js - About 1 hr to fix

                      Function _moveOrCopy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              _moveOrCopy: function(operation, path, destinationPath, allowOverwrite, headers, options) {
                      Severity: Minor
                      Found in core/js/files/client.js - About 45 mins to fix

                        Function move has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                move: function(path, destinationPath, allowOverwrite, headers, options) {
                        Severity: Minor
                        Found in core/js/files/client.js - About 35 mins to fix

                          Function copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  copy: function(path, destinationPath, allowOverwrite, headers, options) {
                          Severity: Minor
                          Found in core/js/files/client.js - About 35 mins to fix

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

                                        this._client.request(
                                            'PUT',
                                            this._buildUrl(path),
                                            headers,
                                            body || ''
                            Severity: Major
                            Found in core/js/files/client.js and 4 other locations - About 2 hrs to fix
                            core/js/files/client.js on lines 684..696
                            core/js/files/client.js on lines 726..739
                            core/js/files/client.js on lines 762..776
                            core/js/files/client.js on lines 805..820

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

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

                                        this._client.request(
                                            'LOCK',
                                            options.pathIsUrl ? path : this._buildUrl(path),
                                            {},
                                            lockBody
                            Severity: Major
                            Found in core/js/files/client.js and 4 other locations - About 2 hrs to fix
                            core/js/files/client.js on lines 657..671
                            core/js/files/client.js on lines 684..696
                            core/js/files/client.js on lines 726..739
                            core/js/files/client.js on lines 805..820

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

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

                                        this._client.request(
                                            'UNLOCK',
                                            options.pathIsUrl ? path : this._buildUrl(path),
                                            {
                                                'Lock-Token': token
                            Severity: Major
                            Found in core/js/files/client.js and 4 other locations - About 2 hrs to fix
                            core/js/files/client.js on lines 657..671
                            core/js/files/client.js on lines 684..696
                            core/js/files/client.js on lines 726..739
                            core/js/files/client.js on lines 762..776

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

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

                                        this._client.request(
                                            operation,
                                            options.pathIsUrl ? path : this._buildUrl(path),
                                            headers
                                        ).then(
                            Severity: Major
                            Found in core/js/files/client.js and 4 other locations - About 2 hrs to fix
                            core/js/files/client.js on lines 657..671
                            core/js/files/client.js on lines 684..696
                            core/js/files/client.js on lines 762..776
                            core/js/files/client.js on lines 805..820

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

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

                                        this._client.request(
                                            method,
                                            this._buildUrl(path)
                                        ).then(
                                            function(result) {
                            Severity: Major
                            Found in core/js/files/client.js and 4 other locations - About 2 hrs to fix
                            core/js/files/client.js on lines 657..671
                            core/js/files/client.js on lines 726..739
                            core/js/files/client.js on lines 762..776
                            core/js/files/client.js on lines 805..820

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

                            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

                                        if (_.isUndefined(options.properties)) {
                                            properties = this.getPropfindProperties();
                                        } else {
                                            properties = options.properties;
                                        }
                            Severity: Minor
                            Found in core/js/files/client.js and 1 other location - About 40 mins to fix
                            core/js/files/client.js on lines 491..495

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

                            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

                                        if (_.isUndefined(options.properties)) {
                                            properties = this.getPropfindProperties();
                                        } else {
                                            properties = options.properties;
                                        }
                            Severity: Minor
                            Found in core/js/files/client.js and 1 other location - About 40 mins to fix
                            core/js/files/client.js on lines 447..451

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

                            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

                            There are no issues that match your filters.

                            Category
                            Status