owncloud/core

View on GitHub
apps/files/js/jquery.fileupload.js

Summary

Maintainability
F
6 days
Test Coverage

File jquery.fileupload.js has 1170 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * jQuery File Upload Plugin
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
Severity: Major
Found in apps/files/js/jquery.fileupload.js - About 3 days to fix

    Function _chunkedUpload has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _chunkedUpload: function (options, testOnly) {
                options.uploadedBytes = options.uploadedBytes || 0;
                var that = this,
                    file = options.files[0],
                    fs = file.size,
    Severity: Major
    Found in apps/files/js/jquery.fileupload.js - About 3 hrs to fix

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

              _onAdd: function (e, data) {
                  var that = this,
                      result = true,
                      options = $.extend({}, this.options, data),
                      files = data.files,
      Severity: Major
      Found in apps/files/js/jquery.fileupload.js - About 3 hrs to fix

        Function _onSend has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _onSend: function (e, data) {
                    if (!data.submit) {
                        this._addConvenienceMethods(e, data);
                    }
                    var that = this,
        Severity: Major
        Found in apps/files/js/jquery.fileupload.js - About 3 hrs to fix

          Function _initXHRData has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _initXHRData: function (options) {
                      var that = this,
                          formData,
                          file = options.files[0],
                          // Ignore non-multipart setting if not supported:
          Severity: Major
          Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

            Function _addConvenienceMethods has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _addConvenienceMethods: function (e, data) {
                        var that = this,
                            getPromise = function (args) {
                                return $.Deferred().resolveWith(that, args).promise();
                            };
            Severity: Major
            Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

              Function _handleFileTreeEntry has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _handleFileTreeEntry: function (entry, path) {
                          var that = this,
                              dfd = $.Deferred(),
                              entries = [],
                              dirReader,
              Severity: Minor
              Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

                Function send has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        send: function (data) {
                            if (data && !this.options.disabled) {
                                if (data.fileInput && !data.files) {
                                    var that = this,
                                        dfd = $.Deferred(),
                Severity: Minor
                Found in apps/files/js/jquery.fileupload.js - About 1 hr to fix

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

                                  send = function () {
                                      that._sending += 1;
                                      // Set timer for bitrate progress calculation:
                                      options._bitrateTimer = new that._BitrateTimer();
                                      jqXHR = jqXHR || (
                  Severity: Minor
                  Found in apps/files/js/jquery.fileupload.js - About 1 hr to fix

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

                            _onProgress: function (e, data) {
                                if (e.lengthComputable) {
                                    var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
                                        loaded;
                                    if (data._time && data.progressInterval &&
                    Severity: Minor
                    Found in apps/files/js/jquery.fileupload.js - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (options.uniqueFilenames) {
                                                          fileName = that._getUniqueFilename(
                                                              fileName,
                                                              options.uniqueFilenames
                                                          );
                      Severity: Major
                      Found in apps/files/js/jquery.fileupload.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (!paramNameSlice.length) {
                                                    paramNameSlice = paramName;
                                                }
                        Severity: Major
                        Found in apps/files/js/jquery.fileupload.js - About 45 mins to fix

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

                                              if (that._trigger(
                                                      'drop',
                                                      $.Event('drop', {delegatedEvent: e}),
                                                      data
                                                  ) !== false) {
                          Severity: Minor
                          Found in apps/files/js/jquery.fileupload.js and 1 other location - About 40 mins to fix
                          apps/files/js/jquery.fileupload.js on lines 1296..1302

                          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

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

                                          if (that._trigger(
                                                  'change',
                                                  $.Event('change', {delegatedEvent: e}),
                                                  data
                                              ) !== false) {
                          Severity: Minor
                          Found in apps/files/js/jquery.fileupload.js and 1 other location - About 40 mins to fix
                          apps/files/js/jquery.fileupload.js on lines 1336..1342

                          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