hummingbird-me/hummingbird

View on GitHub
app/assets/javascripts/old/backbone-1.0.0.js

Summary

Maintainability
F
4 days
Test Coverage

File backbone-1.0.0.js has 929 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//     Backbone.js 1.0.0

//     (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
Severity: Major
Found in app/assets/javascripts/old/backbone-1.0.0.js - About 2 days to fix

    Function set has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        set: function(key, val, options) {
          var attr, attrs, unset, changes, silent, changing, prev, current;
          if (key == null) return this;
    
          // Handle both `"key", value` and `{key: value}` -style arguments.
    Severity: Minor
    Found in app/assets/javascripts/old/backbone-1.0.0.js - About 1 hr to fix

      Function set has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          set: function(models, options) {
            options = _.defaults(options || {}, setOptions);
            if (options.parse) models = this.parse(models, options);
            if (!_.isArray(models)) models = models ? [models] : [];
            var i, l, model, attrs, existing, sort;
      Severity: Minor
      Found in app/assets/javascripts/old/backbone-1.0.0.js - About 1 hr to fix

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

          Backbone.sync = function(method, model, options) {
            var type = methodMap[method];
        
            // Default options, unless specified.
            _.defaults(options || (options = {}), {
        Severity: Minor
        Found in app/assets/javascripts/old/backbone-1.0.0.js - About 1 hr to fix

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

              start: function(options) {
                if (History.started) throw new Error("Backbone.history has already been started");
                History.started = true;
          
                // Figure out the initial configuration. Do we need an iframe?
          Severity: Minor
          Found in app/assets/javascripts/old/backbone-1.0.0.js - About 1 hr to fix

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

                save: function(key, val, options) {
                  var attrs, method, xhr, attributes = this.attributes;
            
                  // Handle both `"key", value` and `{key: value}` -style arguments.
                  if (key == null || typeof key === 'object') {
            Severity: Minor
            Found in app/assets/javascripts/old/backbone-1.0.0.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                            if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
                                (context && context !== ev.context)) {
                              retain.push(ev);
                            }
              Severity: Major
              Found in app/assets/javascripts/old/backbone-1.0.0.js - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
                      params.contentType = 'application/json';
                      params.data = JSON.stringify(options.attrs || model.toJSON(options));
                    }
                Severity: Major
                Found in app/assets/javascripts/old/backbone-1.0.0.js - About 40 mins to fix

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

                    _.each(methods, function(method) {
                      Collection.prototype[method] = function() {
                        var args = slice.call(arguments);
                        args.unshift(this.models);
                        return _[method].apply(_, args);
                  Severity: Major
                  Found in app/assets/javascripts/old/backbone-1.0.0.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/old/backbone-1.0.0.js on lines 576..582

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

                  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

                    _.each(modelMethods, function(method) {
                      Model.prototype[method] = function() {
                        var args = slice.call(arguments);
                        args.unshift(this.attributes);
                        return _[method].apply(_, args);
                  Severity: Major
                  Found in app/assets/javascripts/old/backbone-1.0.0.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/old/backbone-1.0.0.js on lines 949..955

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

                  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