startae/uploadbox

View on GitHub

Showing 30 of 45 total issues

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

/*
 * jQuery File Upload Plugin 5.40.1
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
Severity: Major
Found in app/assets/javascripts/jquery.fileupload.js - About 2 days to fix

    File jquery.ui.widget.js has 403 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * jQuery UI Widget 1.10.3
     * http://jqueryui.com
     *
     * Copyright 2013 jQuery Foundation and other contributors
    Severity: Minor
    Found in app/assets/javascripts/jquery.ui.widget.js - About 5 hrs to fix

      Method uploads_one has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def uploads_one(upload_name, options={})
            default_options = {
              default: false,
              placeholder: false,
              removable: true,
      Severity: Major
      Found in lib/uploadbox/image_uploader.rb - About 4 hrs to fix

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

                        send: function (_, completeCallback) {
                            form = $('<form style="display:none;"></form>');
                            form.attr('accept-charset', options.formAcceptCharset);
                            addParamChar = /\?/.test(options.url) ? '&' : '?';
                            // XDomainRequest only supports GET and POST:
        Severity: Major
        Found in app/assets/javascripts/jquery.iframe-transport.js - About 3 hrs to fix

          Function _chunkedUpload has 85 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 app/assets/javascripts/jquery.fileupload.js - About 3 hrs to fix

            Method uploads_one has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def uploads_one(upload_name, options={})
                  default_options = {
                    default: false,
                    placeholder: false,
                    removable: true,
            Severity: Minor
            Found in lib/uploadbox/image_uploader.rb - 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

            Method uploads_many has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def uploads_many(upload_name, options={})
                  default_options = {
                    default: false,
                    placeholder: false,
                    removable: true,
            Severity: Major
            Found in lib/uploadbox/image_uploader.rb - About 3 hrs to fix

              Function _onSend has 75 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 app/assets/javascripts/jquery.fileupload.js - About 3 hrs to fix

                Function widget has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                $.widget = function( name, base, prototype ) {
                    var fullName, existingConstructor, constructor, basePrototype,
                        // proxiedPrototype allows the provided prototype to remain unmodified
                        // so that it can be used as a mixin for multiple widgets (#8876)
                        proxiedPrototype = {},
                Severity: Major
                Found in app/assets/javascripts/jquery.ui.widget.js - About 2 hrs to fix

                  Function _onAdd has 70 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 app/assets/javascripts/jquery.fileupload.js - About 2 hrs to fix

                    Function _initXHRData has 62 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 app/assets/javascripts/jquery.fileupload.js - About 2 hrs to fix

                      Method uploads_many has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def uploads_many(upload_name, options={})
                            default_options = {
                              default: false,
                              placeholder: false,
                              removable: true,
                      Severity: Minor
                      Found in lib/uploadbox/image_uploader.rb - About 2 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 _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 app/assets/javascripts/jquery.fileupload.js - About 2 hrs to fix

                        Function send has 43 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 app/assets/javascripts/jquery.fileupload.js - About 1 hr to fix

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

                                          send: function (_, completeCallback) {
                                              counter += 1;
                                              var message = {
                                                      id: 'postmessage-transport-' + counter
                                                  },
                          Severity: Minor
                          Found in app/assets/javascripts/cors/jquery.postmessage-transport.js - About 1 hr to fix

                            Method uploads_one has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def uploads_one(upload_name, options={})
                                upload_model_class = "Uploadbox::#{@object.class.base_class.to_s + upload_name.to_s.camelize}".constantize
                            
                                if upload_model_class.versions.present?
                                  options.reverse_merge!(preview: upload_model_class.versions.keys.first,
                            Severity: Minor
                            Found in lib/uploadbox/engine.rb - About 1 hr to fix

                              Function send has 39 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 app/assets/javascripts/jquery.fileupload.js - About 1 hr to fix

                                Function bridge has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                $.widget.bridge = function( name, object ) {
                                    var fullName = object.prototype.widgetFullName || name;
                                    $.fn[ name ] = function( options ) {
                                        var isMethodCall = typeof options === "string",
                                            args = slice.call( arguments, 1 ),
                                Severity: Minor
                                Found in app/assets/javascripts/jquery.ui.widget.js - About 1 hr to fix

                                  Function _on has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      _on: function( suppressDisabledCheck, element, handlers ) {
                                          var delegateElement,
                                              instance = this;
                                  
                                          // no suppressDisabledCheck flag, shuffle arguments
                                  Severity: Minor
                                  Found in app/assets/javascripts/jquery.ui.widget.js - About 1 hr to fix

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

                                      function v1(options, buf, offset) {
                                        var i = buf && offset || 0;
                                        var b = buf || [];
                                    
                                        options = options || {};
                                    Severity: Minor
                                    Found in app/assets/javascripts/_uuid.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language