kandanapp/kandan

View on GitHub

Showing 68 of 68 total issues

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

(function() {

  (function(factory) {
    if (typeof exports === 'object') {
      return factory(require('jquery'));
Severity: Major
Found in app/assets/javascripts/lib/jquery.atwho.js and 1 other location - About 3 days to fix
app/assets/javascripts/lib/jquery.caret.js on lines 18..128

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

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

(function() {

  (function(factory) {
    if (typeof exports === 'object') {
      return factory(require('jquery'));
Severity: Major
Found in app/assets/javascripts/lib/jquery.caret.js and 1 other location - About 3 days to fix
app/assets/javascripts/lib/jquery.atwho.js on lines 597..707

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

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

File backbone.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/lib/backbone.js - About 2 days to fix

    Function Modernizr has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    window.Modernizr = (function( window, document, undefined ) {
    
        var version = '2.8.3',
    
        Modernizr = {},
    Severity: Minor
    Found in app/assets/javascripts/lib/modernizr.js - About 2 days 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

    File underscore.js has 848 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    //     Underscore.js 1.4.4
    //     http://underscorejs.org
    //     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
    //     Underscore may be freely distributed under the MIT license.
    
    
    Severity: Major
    Found in app/assets/javascripts/lib/underscore.js - About 2 days to fix

      Function Modernizr has 379 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      window.Modernizr = (function( window, document, undefined ) {
      
          var version = '2.8.3',
      
          Modernizr = {},
      Severity: Major
      Found in app/assets/javascripts/lib/modernizr.js - About 1 day to fix

        Function filedrop has 324 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          $.fn.filedrop = function(options) {
            var opts = $.extend({}, default_opts, options),
                global_progress = [];
        
            $(document).on('drop', this, drop).on('dragstart', this, opts.dragStart).on('dragenter',this, dragEnter).on('dragover', this, dragOver).on('dragleave', this, dragLeave);
        Severity: Major
        Found in app/assets/javascripts/lib/jquery.filedrop.js - About 1 day to fix

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

          
          /*
            Implement Github like autocomplete mentions
            http://ichord.github.com/At.js
          
          
          Severity: Major
          Found in app/assets/javascripts/lib/jquery.atwho.js - About 1 day to fix

            File underscore.string.js has 464 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            //  Underscore.string
            //  (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org>
            //  Underscore.string is freely distributable under the terms of the MIT license.
            //  Documentation: https://github.com/epeli/underscore.string
            //  Some code is borrowed from MooTools and Alexandru Marasteanu.
            Severity: Minor
            Found in app/assets/javascripts/lib/underscore.string.js - About 7 hrs to fix

              Function upload has 173 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function upload() {
                    stop_loop = false;
              
                    if (!files) {
                      opts.error(errors[0]);
              Severity: Major
              Found in app/assets/javascripts/lib/jquery.filedrop.js - About 6 hrs to fix

                File modernizr.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* Modernizr 2.8.3 (Custom Build) | MIT & BSD
                 * Build: http://modernizr.com/download/#-draganddrop-audio-touch-shiv-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-notification
                 */
                ;
                
                
                Severity: Minor
                Found in app/assets/javascripts/lib/modernizr.js - About 5 hrs to fix

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

                  /*global jQuery:false, alert:false */
                  
                  /*
                   * Default text - jQuery plugin for html5 dragging files from desktop to browser
                   *
                  Severity: Minor
                  Found in app/assets/javascripts/lib/jquery.filedrop.js - About 5 hrs to fix

                    Function toRelativeTime has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                     Date.prototype.toRelativeTime = (function() {
                    
                      var _ = function(options) {
                        var opts = processOptions(options);
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/lib/date.extensions.js - About 4 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 sprintf has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var sprintf = (function() {
                        function get_type(variable) {
                          return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
                        }
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/lib/underscore.string.js - About 4 hrs to fix

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

                          strRightBack: function(str, sep){
                            if (str == null) return '';
                            str = String(str); sep = sep != null ? String(sep) : sep;
                            var pos = !sep ? -1 : str.lastIndexOf(sep);
                            return ~pos ? str.slice(pos+sep.length, str.length) : str;
                      Severity: Major
                      Found in app/assets/javascripts/lib/underscore.string.js and 1 other location - About 3 hrs to fix
                      app/assets/javascripts/lib/underscore.string.js on lines 450..455

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

                      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

                          strRight: function(str, sep){
                            if (str == null) return '';
                            str = String(str); sep = sep != null ? String(sep) : sep;
                            var pos = !sep ? -1 : str.indexOf(sep);
                            return ~pos ? str.slice(pos+sep.length, str.length) : str;
                      Severity: Major
                      Found in app/assets/javascripts/lib/underscore.string.js and 1 other location - About 3 hrs to fix
                      app/assets/javascripts/lib/underscore.string.js on lines 457..462

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

                      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 send has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            var send = function(e) {
                      
                              var fileIndex = ((typeof(e.srcElement) === "undefined") ? e.target : e.srcElement).index;
                      
                              // Sometimes the index is not attached to the
                      Severity: Major
                      Found in app/assets/javascripts/lib/jquery.filedrop.js - About 3 hrs to fix

                        Function process has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              var process = function() {
                        
                                var fileIndex;
                        
                                if (stop_loop) {
                        Severity: Major
                        Found in app/assets/javascripts/lib/jquery.filedrop.js - About 2 hrs to fix

                          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/lib/backbone.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/lib/backbone.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

                          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/lib/backbone.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/lib/backbone.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

                          Severity
                          Category
                          Status
                          Source
                          Language