volontariat/voluntary

View on GitHub

Showing 242 of 242 total issues

Method create_from_table has 37 lines of code (exceeds 25 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 1 hr to fix

    Method path_to has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def path_to(page_name)
        case page_name
    
        when /^the home\s?page$/
          '/'

      Method render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def render(item_container)
                content, first_item_selected = '', false
                  
                item_container.items.each do |item|
                  next if [
      Severity: Minor
      Found in lib/vendors/simple_navigation/renderer/twitter_sidenav.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 letOutMatchedCompetitorsOfWinnerWinAgainstLoser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            CompetitiveList.prototype.letOutMatchedCompetitorsOfWinnerWinAgainstLoser = function(winnerId, loserId) {
              var base;
              (base = this.outmatchedCompetitorsByCompetitor)[winnerId] || (base[winnerId] = []);
              return $.each(this.outmatchedCompetitorsByCompetitor[winnerId], (function(_this) {
                return function(index, competitorId) {
      Severity: Minor
      Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

        Function buildFormatTokens has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function buildFormatTokens() {
        
            createPaddedToken('f', function(d) {
              return callDateGet(d, 'Milliseconds');
            }, true);
        Severity: Minor
        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

          Method table_cell has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def table_cell column, resource, alternative_value = nil
                value = '-'
                
                if column == 'name'
                  value = resource.send(column)
          Severity: Minor
          Found in app/helpers/voluntary/collection_helper.rb - About 1 hr to fix

            Function sort has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  options.sort = function(event, ui) {
                    var parent = ui.item.parent(),
                      myIndex = ui.item.data('i'),
                      top = parseInt(ui.item.css('top').replace('px', '')),
                      left = parseInt(ui.item.css('left').replace('px', ''));
            Severity: Minor
            Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 1 hr to fix

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

                def initialize(user, options = {})
                  controller_namespace = options[:controller_namespace] || ""
                  project = options[:project] || nil
                  
                  alias_action :index, :show, :autocomplete, :parents, :childs, :tree, to: :read
              Severity: Minor
              Found in app/models/ability.rb - About 1 hr to fix

                Function createLazyFunction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function createLazyFunction(fn, ms, immediate, limit) {
                    var queue = [], locked = false, execute, rounded, perExecution, result;
                    ms = ms || 1;
                    limit = limit || Infinity;
                    rounded = ceil(ms);
                Severity: Minor
                Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

                  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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                        return new Range(
                          this.start > range.start ? this.start : range.start,
                          this.end   < range.end   ? this.end   : range.end
                        );
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/sugar.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/voluntary/lib/sugar.js on lines 5437..5440

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 60.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                        return new Range(
                          this.start < range.start ? this.start : range.start,
                          this.end   > range.end   ? this.end   : range.end
                        );
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/sugar.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/voluntary/lib/sugar.js on lines 5457..5460

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 60.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                          GmUtility.setPosition(gmapContext, place.geometry.location, function(context) {
                                              updateInputValues(inputBinding, context);
                                              context.settings.onchanged.apply(gmapContext.domContainer,
                                                  [GmUtility.locationFromLatLng(context.location), context.radius, false]);
                                          });
                      app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js on lines 208..212

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 59.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                                          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]);
                                                          });
                      app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js on lines 189..193

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 59.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      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

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    $(document.body).on('click', '#bootstrap_modal .cancel_tournament_button', (function(_this) {
                                      return function(event) {
                                        event.preventDefault();
                                        return _this.cancelTournament();
                                      };
                            app/assets/javascripts/voluntary/lib/jquery-competitive_list.js on lines 61..66

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 58.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Severity
                            Category
                            Status
                            Source
                            Language