kandanapp/kandan

View on GitHub

Showing 44 of 68 total issues

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

    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

        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

            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/lib/backbone.js - About 1 hr to fix

              Function rect has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    Controller.prototype.rect = function() {
                      var $inputor, Sel, at_rect, bottom, format, html, offset, start_range, x, y;
                      $inputor = this.$inputor;
                      if (document.selection) {
                        Sel = document.selection.createRange();
              Severity: Minor
              Found in app/assets/javascripts/lib/jquery.atwho.js - About 1 hr to fix

                Function injectElementWithStyles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    injectElementWithStyles = function( rule, callback, nodes, testnames ) {
                
                      var style, ret, node, docOverflow,
                          div = document.createElement('div'),
                                body = document.body,
                Severity: Minor
                Found in app/assets/javascripts/lib/modernizr.js - About 1 hr to fix

                  Function onload has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          xhr.onload = function() {
                              var serverResponse = null;
                  
                              if (xhr.responseText) {
                                try {
                  Severity: Minor
                  Found in app/assets/javascripts/lib/jquery.filedrop.js - About 1 hr to fix

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

                          Controller.prototype.on_keydown = function(e) {
                            if (!this.view.visible()) {
                              return;
                            }
                            switch (e.keyCode) {
                    Severity: Minor
                    Found in app/assets/javascripts/lib/jquery.atwho.js - About 1 hr to fix

                      Method check_external_avatar has 27 lines of code (exceeds 25 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

                        Function catch_query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              Controller.prototype.catch_query = function() {
                                var caret_pos, content, end, query, start, subtext,
                                  _this = this;
                                content = this.$inputor.val();
                                caret_pos = this.$inputor.caretPos();
                        Severity: Minor
                        Found in app/assets/javascripts/lib/jquery.atwho.js - About 1 hr to fix

                          Function isEventSupported has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              isEventSupported = (function() {
                          
                                var TAGNAMES = {
                                  'select': 'input', 'change': 'input',
                                  'submit': 'form', 'reset': 'form',
                          Severity: Minor
                          Found in app/assets/javascripts/lib/modernizr.js - About 1 hr to fix

                            Function bind has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  Function.prototype.bind = function bind(that) {
                            
                                    var target = this;
                            
                                    if (typeof target != "function") {
                            Severity: Minor
                            Found in app/assets/javascripts/lib/modernizr.js - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                            while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
                                              if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
                                                field_list.push(field_match[1]);
                                              }
                                              else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
                              Severity: Major
                              Found in app/assets/javascripts/lib/underscore.string.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                              if (!arg.hasOwnProperty(match[2][k])) {
                                                throw new Error(sprintf('[_.sprintf] property "%s" does not exist', match[2][k]));
                                              }
                                Severity: Major
                                Found in app/assets/javascripts/lib/underscore.string.js - About 45 mins 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/lib/backbone.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/lib/backbone.js - About 40 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                          return -1;
                                      Severity: Major
                                      Found in app/assets/javascripts/lib/underscore.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language