startae/uploadbox

View on GitHub

Showing 45 of 45 total issues

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 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 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 _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

              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

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

                            (function (factory) {
                                'use strict';
                                if (typeof define === 'function' && define.amd) {
                                    // Register as an anonymous AMD module:
                                    define(['jquery'], factory);
                            Severity: Major
                            Found in app/assets/javascripts/jquery.iframe-transport.js and 2 other locations - About 1 hr to fix
                            app/assets/javascripts/cors/jquery.postmessage-transport.js on lines 15..118
                            app/assets/javascripts/cors/jquery.xdr-transport.js on lines 18..87

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

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

                            (function (factory) {
                                'use strict';
                                if (typeof define === 'function' && define.amd) {
                                    // Register as an anonymous AMD module:
                                    define(['jquery'], factory);
                            app/assets/javascripts/cors/jquery.xdr-transport.js on lines 18..87
                            app/assets/javascripts/jquery.iframe-transport.js on lines 14..214

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

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

                            (function (factory) {
                                'use strict';
                                if (typeof define === 'function' && define.amd) {
                                    // Register as an anonymous AMD module:
                                    define(['jquery'], factory);
                            Severity: Major
                            Found in app/assets/javascripts/cors/jquery.xdr-transport.js and 2 other locations - About 1 hr to fix
                            app/assets/javascripts/cors/jquery.postmessage-transport.js on lines 15..118
                            app/assets/javascripts/jquery.iframe-transport.js on lines 14..214

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

                            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

                                  @template.render partial: 'uploadbox/images/uploads_one', locals: {
                                    upload_name: upload_name,
                                    resource: @object,
                                    form: self,
                                    version: options[:preview],
                            Severity: Major
                            Found in lib/uploadbox/engine.rb and 1 other location - About 1 hr to fix
                            lib/uploadbox/engine.rb on lines 94..108

                            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

                                @template.render partial: 'uploadbox/images/uploads_many', locals: {
                                  upload_name: upload_name,
                                  resource: @object,
                                  form: self,
                                  version: options[:preview],
                            Severity: Major
                            Found in lib/uploadbox/engine.rb and 1 other location - About 1 hr to fix
                            lib/uploadbox/engine.rb on lines 51..65

                            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

                            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

                              Severity
                              Category
                              Status
                              Source
                              Language