RacoonsGroup/ttng

View on GitHub

Showing 44 of 61 total issues

File selectize.js has 2258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * sifter.js
 * Copyright (c) 2013 Brian Reavis & contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
Severity: Major
Found in app/assets/javascripts/libs/selectize.js - About 6 days to fix

    Function setup has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            setup: function() {
                var self      = this;
                var settings  = self.settings;
                var eventNS   = self.eventNS;
                var $window   = $(window);
    Severity: Major
    Found in app/assets/javascripts/libs/selectize.js - About 5 hrs to fix

      Function selectize has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.fn.selectize = function(settings_user) {
              var defaults             = $.fn.selectize.defaults;
              var settings             = $.extend({}, defaults, settings_user);
              var attr_data            = settings.dataAttr;
              var field_label          = settings.labelField;
      Severity: Major
      Found in app/assets/javascripts/libs/selectize.js - About 4 hrs to fix

        Method initialize has 104 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(user)
            user ||= User.new
        
            if user.chief?
              can :manage, :all
        Severity: Major
        Found in app/models/ability.rb - About 4 hrs to fix

          Function refreshOptions has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  refreshOptions: function(triggerDropdown) {
                      var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
                      var $active, $active_before, $create;
              
                      if (typeof triggerDropdown === 'undefined') {
          Severity: Major
          Found in app/assets/javascripts/libs/selectize.js - About 3 hrs to fix

            Method build_server_tree has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

              def build_server_tree(tree, options= {})
                result = ''
                tree   = Array.wrap tree
                opts   = {
                  # node and base node params
            Severity: Minor
            Found in app/helpers/the_sortable_tree_helper.rb - About 3 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 onKeyDown has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    onKeyDown: function(e) {
                        var isInput = e.target === this.$control_input[0];
                        var self = this;
                
                        if (self.isLocked) {
            Severity: Major
            Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

              Function getSortFunction has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Sifter.prototype.getSortFunction = function(search, options) {
                      var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
              
                      self   = this;
                      search = self.prepareSearch(search, options);
              Severity: Major
              Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

                Function init_select has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        var init_select = function($input, settings_element) {
                            var i, n, tagName, $children, order = 0;
                            var options = settings_element.options;
                    
                            var readData = function($el) {
                Severity: Major
                Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

                  Function mixin has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      MicroPlugin.mixin = function(Interface) {
                          Interface.plugins = {};
                  
                          /**
                           * Initializes the listed plugins (with options).
                  Severity: Major
                  Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

                    Function getScoreFunction has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Sifter.prototype.getScoreFunction = function(search, options) {
                            var self, fields, tokens, token_count;
                    
                            self        = this;
                            search      = self.prepareSearch(search, options);
                    Severity: Major
                    Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

                      Function Selectize has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          var Selectize = function($input, settings) {
                              var key, i, n, dir, input, self = this;
                              input = $input[0];
                              input.selectize = self;
                          
                      Severity: Major
                      Found in app/assets/javascripts/libs/selectize.js - About 2 hrs to fix

                        Method main_navigation has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def main_navigation
                            render_navigation renderer: :bootstrap do |primary|
                              primary.dom_class = 'nav navbar-nav'
                              primary.selected_class = 'active'
                        
                        
                        Severity: Minor
                        Found in app/helpers/navigation_helper.rb - About 2 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

                        Method admin_navigation has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def admin_navigation
                            render_navigation renderer: :bootstrap do |primary|
                              primary.dom_class = 'nav navbar-nav'
                              primary.selected_class = 'active'
                              primary.item :key_1_1, t('navigation.home'), root_path, class: 'item', icon: 'home'
                        Severity: Minor
                        Found in app/helpers/navigation_helper.rb - About 2 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

                        Method build_server_tree has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def build_server_tree(tree, options= {})
                            result = ''
                            tree   = Array.wrap tree
                            opts   = {
                              # node and base node params
                        Severity: Minor
                        Found in app/helpers/the_sortable_tree_helper.rb - About 1 hr to fix

                          Function setActiveItem has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  setActiveItem: function($item, e) {
                                      var self = this;
                                      var eventName;
                                      var i, idx, begin, end, item, swap;
                                      var $last;
                          Severity: Minor
                          Found in app/assets/javascripts/libs/selectize.js - About 1 hr to fix

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

                                var autoGrow = function($input) {
                                    var currentWidth = null;
                                
                                    var update = function(e, options) {
                                        var value, keyCode, printable, placeholder, width;
                            Severity: Minor
                            Found in app/assets/javascripts/libs/selectize.js - About 1 hr to fix

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

                                      deleteSelection: function(e) {
                                          var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
                                          var self = this;
                                  
                                          direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
                              Severity: Minor
                              Found in app/assets/javascripts/libs/selectize.js - About 1 hr to fix

                                Method compare has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def compare
                                    return not_allowed unless history_allowed?
                                
                                    if @page.new_record?
                                      render_template 'no'
                                Severity: Minor
                                Found in app/controllers/wiki_pages_controller.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 update has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        var update = function(e, options) {
                                            var value, keyCode, printable, placeholder, width;
                                            var shift, character, selection;
                                            e = e || window.event || {};
                                            options = options || {};
                                Severity: Minor
                                Found in app/assets/javascripts/libs/selectize.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language