kandanapp/kandan

View on GitHub

Showing 68 of 68 total issues

Function eq has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var eq = function(a, b, aStack, bStack) {
    // Identical objects are equal. `0 === -0`, but they aren't identical.
    // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
    if (a === b) return a !== 0 || 1 / a == 1 / b;
    // A strict comparison is necessary because `null == undefined`.
Severity: Major
Found in app/assets/javascripts/lib/underscore.js - About 2 hrs to fix

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

     Date.prototype.toRelativeTime = (function() {
    
      var _ = function(options) {
        var opts = processOptions(options);
    
    
    Severity: Major
    Found in app/assets/javascripts/lib/date.extensions.js - About 2 hrs 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/lib/backbone.js - About 1 hr to fix

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

            str_format.format = function(parse_tree, argv) {
              var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
              for (i = 0; i < tree_length; i++) {
                node_type = get_type(parse_tree[i]);
                if (node_type === 'string') {
        Severity: Minor
        Found in app/assets/javascripts/lib/underscore.string.js - About 1 hr to fix

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

              str_format.parse = function(fmt) {
                var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
                while (_fmt) {
                  if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
                    parse_tree.push(match[0]);
          Severity: Minor
          Found in app/assets/javascripts/lib/underscore.string.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/lib/backbone.js - About 1 hr to fix

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

                  each(obj, function(value, index, list) {
                    var computed = iterator ? iterator.call(context, value, index, list) : value;
                    computed < result.computed && (result = {value : value, computed : computed});
                  });
              Severity: Major
              Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/underscore.js on lines 265..268

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

              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(obj, function(value, index, list) {
                    var computed = iterator ? iterator.call(context, value, index, list) : value;
                    computed >= result.computed && (result = {value : value, computed : computed});
                  });
              Severity: Major
              Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/underscore.js on lines 279..282

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

              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

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

                _.template = function(text, data, settings) {
                  var render;
                  settings = _.defaults({}, settings, _.templateSettings);
              
                  // Combine delimiters into one regular expression via alternation.
              Severity: Minor
              Found in app/assets/javascripts/lib/underscore.js - About 1 hr to fix

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

                    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
                      return Math.min.apply(Math, obj);
                    }
                Severity: Major
                Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/lib/underscore.js on lines 260..262

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

                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 (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
                      return Math.max.apply(Math, obj);
                    }
                Severity: Major
                Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/lib/underscore.js on lines 274..276

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

                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

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

                    return $.fn.inputHistory = function(options) {
                      var history, _this = this;
                      options || (options = {});
                      options.data || (options.data = 'inputHistory');
                
                
                Severity: Minor
                Found in app/assets/javascripts/lib/jquery.inputHistory.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/lib/backbone.js - About 1 hr to fix

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

                        if (nativeReduce && obj.reduce === nativeReduce) {
                          if (context) iterator = _.bind(iterator, context);
                          return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
                        }
                    Severity: Major
                    Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/lib/underscore.js on lines 132..135

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

                    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

                          options.next = normalizeKeyHandler(options.next, function(e) {
                            return (e.keyCode === 40 && e.altKey) || (e.ctrlKey && e.keyCode === 78);
                          });
                    Severity: Major
                    Found in app/assets/javascripts/lib/jquery.inputHistory.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/lib/jquery.inputHistory.js on lines 119..121

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

                    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

                          options.prev = normalizeKeyHandler(options.prev, function(e) {
                            return (e.keyCode === 38 && e.altKey) || (e.ctrlKey && e.keyCode === 80);
                          });
                    Severity: Major
                    Found in app/assets/javascripts/lib/jquery.inputHistory.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/lib/jquery.inputHistory.js on lines 123..125

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

                    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 (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
                          if (context) iterator = _.bind(iterator, context);
                          return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
                        }
                    Severity: Major
                    Found in app/assets/javascripts/lib/underscore.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/lib/underscore.js on lines 111..114

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

                    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

                    Method check_external_avatar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def check_external_avatar
                        # avatar url is not required
                        return if self.avatar_url.blank?
                    
                        uri = URI(avatar_url)
                    Severity: Minor
                    Found in app/models/user.rb - About 1 hr 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 getBuilder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function getBuilder(filename, filedata, mime, boundary) {
                          var dashdash = '--',
                              crlf = '\r\n',
                              builder = '';
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/lib/jquery.filedrop.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/lib/backbone.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language