volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

File sugar.js has 4177 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  Sugar Library edge
 *
 *  Freely distributable and licensed under the MIT-style license.
 *  Copyright (c) 2015 Andrew Plummer
Severity: Major
Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 wk to fix

    Method menu_code has a Cognitive Complexity of 463 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.menu_code(resource)
          case resource
          when :areas
            Proc.new do |primary, options|
              primary.item :areas, I18n.t('areas.index.title'), areas_path do |areas|
    Severity: Minor
    Found in lib/voluntary/navigation.rb - About 1 wk 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 menu_code has 218 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.menu_code(resource)
          case resource
          when :areas
            Proc.new do |primary, options|
              primary.item :areas, I18n.t('areas.index.title'), areas_path do |areas|
    Severity: Major
    Found in lib/voluntary/navigation.rb - About 1 day to fix

      File jquery-competitive_list.js has 494 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function() {
        (function($, window) {
          var CompetitiveList;
          CompetitiveList = CompetitiveList = (function() {
            CompetitiveList.prototype.jqueryInstanceMethodName = 'competitiveList';
      Severity: Minor
      Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 7 hrs to fix

        Function getExtendedDate has 192 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function getExtendedDate(contextDate, f, localeCode, prefer, forceUTC) {
            // TODO can we split this up into smaller methods?
            var d, relative, baseLocalization, afterCallbacks, loc, set, unit, unitIndex, weekday, num, tmp, weekdayForward;
        
            afterCallbacks = [];
        Severity: Major
        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 7 hrs to fix

          Method up has 164 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def up
              MongoDatabaseCleaner.clean
              
              create_table :users do |t|
                t.string :name
          Severity: Major
          Found in dummy/db/migrate/20130606195330_create_schema.voluntary_engine.rb - About 6 hrs to fix

            Function setLocalization has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function setLocalization(localeCode, set) {
                var loc;
            
                function initializeField(name) {
                  var val = loc[name];
            Severity: Major
            Found in app/assets/javascripts/voluntary/lib/sugar.js - About 4 hrs to fix

              Method included has 106 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def self.included(base)
                      base.class_eval do
                        include ErrorHandling
                        include TransitionActions
                        
              Severity: Major
              Found in lib/applicat/mvc/controller.rb - About 4 hrs to fix

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

                (function ( $ ) {
                
                    /**
                     * Holds google map object and related utility entities.
                     * @constructor

                  Function multisortable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    $.fn.multisortable = function(options) {
                      if (!options) {
                        options = {}
                      }
                      var settings = $.extend({}, $.fn.multisortable.defaults, options);
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 3 hrs to fix

                    Function locationpicker has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $.fn.locationpicker = function( options, params ) {
                            if (typeof options == 'string') { // Command provided
                                var _targetDomElement = this.get(0);
                                // Plug-in is not applied - nothing to do.
                                if (!isPluginApplied(_targetDomElement)) return;

                      Method included has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.included(base)
                          base.extend ClassMethods
                          
                          base.class_eval do
                            include Model::MongoDb::StateVersionAttributes
                      Severity: Minor
                      Found in app/models/state_machines/task.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 buildBase64 has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function buildBase64(key) {
                          var encodeAscii, decodeAscii;
                      
                          function catchEncodingError(fn) {
                            return function(str) {
                      Severity: Major
                      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 3 hrs to fix

                        Method create_from_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create_from_table(model_name, table, extra = {})
                            factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                            is_singular = model_name.to_s.singularize == model_name.to_s
                            
                            hashes = if is_singular

                        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 create_from_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create_from_table(model_name, table, extra = {})
                            factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                            is_singular = model_name.to_s.singularize == model_name.to_s
                            
                            hashes = if is_singular
                        Severity: Minor
                        Found in dummy/features/step_definitions/factory_steps.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

                        Method create_from_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create_from_table(model_name, table, extra = {})
                            factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                            is_singular = model_name.to_s.singularize == model_name.to_s
                            
                            hashes = if is_singular

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

                          function buildDateMethods() {
                            extendSimilar(date, DateUnits, function(methods, u, i) {
                              var name = u.name, caps = simpleCapitalize(name), since, until;
                              u.addMethod = 'add' + caps + 's';
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 3 hrs to fix

                          Function multiselectable has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            $.fn.multiselectable = function(options) {
                              if (!options) {
                                options = {}
                              }
                              options = $.extend({}, $.fn.multiselectable.defaults, options);
                          Severity: Major
                          Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 3 hrs to fix

                            Function init has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function init (converter) {
                                function api (key, value, attributes) {
                                  var result;
                            
                                  // Write
                            Severity: Major
                            Found in app/assets/javascripts/voluntary/lib/jquery.cookie.js - About 3 hrs to fix

                              Method update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def update
                                  if params[:event] && params[:event].keys.select{|k| ['cancel', 'skip'].include?(k)}.any?
                                    send(params[:event].keys.first)
                                    return
                                  end
                              Severity: Minor
                              Found in app/controllers/workflow/tasks_controller.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

                              Severity
                              Category
                              Status
                              Source
                              Language