startae/uploadbox

View on GitHub

Showing 30 of 45 total issues

Function name has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn[ name ] = function( options ) {
        var isMethodCall = typeof options === "string",
            args = slice.call( arguments, 1 ),
            returnValue = this;

Severity: Minor
Found in app/assets/javascripts/jquery.ui.widget.js - About 1 hr to fix

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

                        send: function (headers, completeCallback) {
                            var addParamChar = /\?/.test(s.url) ? '&' : '?';
                            function callback(status, statusText, responses, responseHeaders) {
                                xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
                                xdr = null;
    Severity: Minor
    Found in app/assets/javascripts/cors/jquery.xdr-transport.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 app/assets/javascripts/jquery.fileupload.js - About 1 hr to fix

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

                _handleFileTreeEntry: function (entry, path) {
                    var that = this,
                        dfd = $.Deferred(),
                        errorHandler = function (e) {
                            if (e && !e.entry) {
        Severity: Minor
        Found in app/assets/javascripts/jquery.fileupload.js - About 1 hr to fix

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

              option: function( key, value ) {
                  var options = key,
                      parts,
                      curOption,
                      i;
          Severity: Minor
          Found in app/assets/javascripts/jquery.ui.widget.js - About 1 hr to fix

            Method after_enqueue_scale_up has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def after_enqueue_scale_up(*args)
                  [
                    {
                      :workers => 1, # This many workers
                      :job_count => 1 # For this many jobs or more, until the next level
            Severity: Minor
            Found in lib/heroku_resque_auto_scale.rb - About 1 hr to fix

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

                  _createWidget: function( options, element ) {
                      element = $( element || this.defaultElement || this )[ 0 ];
                      this.element = $( element );
                      this.uuid = uuid++;
                      this.eventNamespace = "." + this.widgetName + this.uuid;
              Severity: Minor
              Found in app/assets/javascripts/jquery.ui.widget.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

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

                  Method after_enqueue_scale_up has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def after_enqueue_scale_up(*args)
                        [
                          {
                            :workers => 1, # This many workers
                            :job_count => 1 # For this many jobs or more, until the next level
                  Severity: Minor
                  Found in lib/heroku_resque_auto_scale.rb - About 45 mins 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 img has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def img(source, options={})
                        if source.respond_to?(:url) and source.respond_to?(:width) and source.respond_to?(:height)
                          if source.processing?
                            data = {
                              processing: source.processing?,
                  Severity: Minor
                  Found in app/helpers/uploadbox/img_helper.rb - About 25 mins 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