volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

Method a_tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def a_tags(item_container, parent_list = [])
          item_container.items.inject([]) do |list, item|
            if item.method.blank? && item.selected?
              list << tag_for(item) unless parent_list.join('').match(item.url.split('#').first)
      

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

  function collateStrings(a, b) {
    var aValue, bValue, aChar, bChar, aEquiv, bEquiv, index = 0, tiebreaker = 0;

    var sortIgnore      = sugarArray[AlphanumericSortIgnore];
    var sortIgnoreCase  = sugarArray[AlphanumericSortIgnoreCase];
Severity: Minor
Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

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

              def self.included(base)
                base.class_eval do
                  cattr_reader :per_page
                  @@per_page = 20
      
    Severity: Minor
    Found in lib/applicat/mvc/model/resource/base.rb - About 1 hr to fix

      Function GMapContext has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function GMapContext(domElement, options) {
              var _map = new google.maps.Map(domElement, options);
              var _marker = new google.maps.Marker({
                  position: new google.maps.LatLng(54.19335, -3.92695),
                  map: _map,

        Function stringify has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function stringify(thing, stack) {
            var type = typeof thing, isObject, isArrayLike, klass, value, arr, key, i, len;
        
            // Return quickly if string to save cycles
            if (type === 'string') return thing;
        Severity: Minor
        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

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

                CompetitiveList.prototype.init = function(el, options) {
                  this.options = $.extend({}, this.defaults, options);
                  this.$el = $(el);
                  this.id = this.$el.attr('id');
                  $.data(el, this.constructor.prototype.jqueryInstanceMethodName, this);
          Severity: Minor
          Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

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

                    address_component_from_google_geocode: function(address_components) {
                        var result = {};
                        for (var i = address_components.length-1; i>=0; i--) {
                            var component = address_components[i];
                            // Postal code

              Method setup_wizard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def setup_wizard
                    @step  = action_name.try(:to_sym)
                    
                    unless wizard_steps.include? @step
                      @step = nil
              Severity: Minor
              Found in lib/wizard.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

              Method matrix has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.matrix(argumentables)
                  arguments = []
                  
                  argumentables.each do |index, argumentable|
                    arguments += Argument.where(
              Severity: Minor
              Found in app/models/argument.rb - About 1 hr to fix

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

                  function mergeObject(target, source, deep, resolve) {
                
                    // Will not merge a primitive type.
                    if (!isObjectType(source)) return target;
                
                
                Severity: Minor
                Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

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

                        CompetitiveList.prototype.start = function() {
                          var matchesAlreadyExist, matchesWithoutWinner;
                          matchesAlreadyExist = false;
                          this.matches || (this.matches = []);
                          if (this.matches.length > 0) {
                  Severity: Minor
                  Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

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

                        function regroup(item, list) {
                          if (list.find('.' + settings.selectedClass).length > 0) {
                            var myIndex = item.data('i');
                    
                            var itemsBefore = list.find('.' + settings.selectedClass).filter(function() {
                    Severity: Minor
                    Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 1 hr to fix

                      Method comparison has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def comparison
                                  options = {}
                                
                                  arguments = Argument.compare_two_argumentables(params[:argumentable_type], params[:side], params[:left_thing_name], params[:right_thing_name]).
                                              paginate(page: params[:page], per_page: 10)
                      Severity: Minor
                      Found in app/controllers/voluntary/api/v1/things/arguments_controller.rb - About 1 hr to fix

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

                          def up
                            if (Product::Ranking rescue nil)
                              add_column :arguments, :argumentable_type, :string
                              add_column :arguments, :argumentable_id, :integer
                              

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

                            function compareDate(d, find, localeCode, buffer, forceUTC) {
                              var p, t, min, max, override, accuracy = 0, loBuffer = 0, hiBuffer = 0;
                              p = getExtendedDate(null, find, localeCode, null, forceUTC);
                              if (buffer > 0) {
                                loBuffer = hiBuffer = buffer;
                          Severity: Minor
                          Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

                            Method step_from_state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def step_from_state
                                  return false unless wizard_step_per_state.is_a?(Hash)
                                   
                                  state = resource.try(:state).try(:to_sym)
                                  
                            Severity: Minor
                            Found in lib/wizard.rb - About 55 mins 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 next_task_for_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def next_task_for_user(user)
                                return nil if (users_without_tasks_ids || []).include?(user.id)
                                
                                task = tasks.assigned.not.in(state: ['under_supervision', 'completed']).
                                       where(user_id: user.id).first
                            Severity: Minor
                            Found in app/models/story.rb - About 55 mins 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 set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def set_value(hash, attribute)
                                value = hash[attribute]
                                
                                if value.match '@' 
                                  if eval(value)

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

                              def set_value(hash, attribute)
                                value = hash[attribute]
                                
                                if value.match '@' 
                                  if eval(value)
                            Severity: Minor
                            Found in dummy/features/step_definitions/factory_steps.rb - About 55 mins 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 set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def set_value(hash, attribute)
                                value = hash[attribute]
                                
                                if value.match '@' 
                                  if eval(value)

                            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