volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

Function defineOnGlobal has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function defineOnGlobal(klass, name, instance, original, prop, existed, polyfill) {
Severity: Major
Found in app/assets/javascripts/voluntary/lib/sugar.js - About 50 mins to fix

    Method cache_associations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def cache_associations
        self.story_id = task.story_id if task_id.present? && (task rescue nil)
        self.offeror_id = task.offeror_id if task_id.present? && (task rescue nil) && task.story.with_offeror
      end
    Severity: Minor
    Found in app/models/result.rb - About 45 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

    Avoid deeply nested control flow statements.
    Open

                                  comments.item(:new, I18n.t('general.new'), new_story_comment_path(@story)) if @comment
    Severity: Major
    Found in lib/voluntary/navigation.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (set.shift && !set.unit) {
                      set.unit = loc.units[5];
                    }
      Severity: Major
      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                  unless (@task.new_record? rescue true)
        Severity: Major
        Found in lib/voluntary/navigation.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (set.shift && !set.unit) set.unit = loc.units[7];
          Severity: Major
          Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    unless (@task.new_record? rescue true)
            Severity: Major
            Found in lib/voluntary/navigation.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if can? :destroy, @task
                                            task.item :destroy, I18n.t('general.destroy'), task_path(@task), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
                                          end
              Severity: Major
              Found in lib/voluntary/navigation.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if (set.num && set.month) {
                                // If we have "the 2nd Tuesday of June", then pass the "weekdayForward" flag
                                // along to updateDate so that the date does not accidentally traverse into
                                // the previous month. This needs to be independent of the "prefer" flag because
                                // we are only ensuring that the weekday is in the future, not the entire date.
                Severity: Major
                Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (set.shift) {
                                  // Shift and unit, ie "next month", "last week", etc.
                                  num *= (tmp = loc.modifiersByName[set.shift]) ? tmp.value : 0;
                                }
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  if (isDefined(set.weekday)) {
                                    // Units can be with non-relative dates, set here. ie "the day after monday"
                                    setDate(d, [{ weekday: set.weekday }, true]);
                                    delete set.weekday;
                                  }
                    Severity: Major
                    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                      Function arrayFind has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        function arrayFind(arr, f, startIndex, loop, returnIndex, context) {
                      Severity: Minor
                      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                        Method set_project_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def set_project_defaults(attributes)
                            attributes[:user_id] ||= @me.id if @me && !attributes[:user_id]
                            attributes[:product_id] ||= @product.id if @product && !attributes[:product_id]
                            attributes[:area_ids] ||= [Area.last.id] if Area.any? && !attributes[:area_ids]
                          end
                        Severity: Minor
                        Found in dummy/features/step_definitions/project_steps.rb - About 45 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

                        Avoid deeply nested control flow statements.
                        Open

                                      if (set.sign && (tmp = loc.modifiersByName[set.sign])) {
                                        // Unit and sign, ie "months ago", "weeks from now", etc.
                                        num *= tmp.value;
                                      }
                        Severity: Major
                        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      task.item :edit, I18n.t('general.edit'), edit_task_path(@task) if can? :edit, @task
                          Severity: Major
                          Found in lib/voluntary/navigation.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                          unless (@result.new_record? rescue true)
                                                            results.item(:show, @result.name, result_path(@result)) do |result|
                                                              if can? :destroy, @result
                                                                result.item :destroy, I18n.t('general.destroy'), result_path(@result), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
                                                              end
                            Severity: Major
                            Found in lib/voluntary/navigation.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                            if (set.offsetSign === '-') {
                                              set.offsetMinutes *= -1;
                                            }
                              Severity: Major
                              Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

                                Method translate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def translate(locale, key, options = {})
                                        default = extract_non_symbol_default!(options) if options[:default]
                                        options.merge!(:default => default) if default
                                
                                        I18n.fallbacks[locale].each do |fallback|
                                Severity: Minor
                                Found in lib/i18n_interpolation_fallbacks.rb - About 45 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

                                Avoid deeply nested control flow statements.
                                Open

                                                              if @comment.try(:id) && can?(:edit, @comment)
                                                                comments.item(:edit, I18n.t('general.edit'), edit_comment_path(@comment))
                                                              end
                                Severity: Major
                                Found in lib/voluntary/navigation.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                  if(status == google.maps.GeocoderStatus.OK  && results && results.length) {
                                                                      GmUtility.setPosition(gmapContext, results[0].geometry.location, function(context) {
                                                                          updateInputValues(inputBinding, context);
                                                                          context.settings.onchanged.apply(gmapContext.domContainer,
                                                                              [GmUtility.locationFromLatLng(context.location), context.radius, false]);
                                  Severity: Major
                                  Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language