volontariat/voluntary

View on GitHub

Showing 242 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

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

      module FactoryMethods
        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
          
      dummy/features/step_definitions/factory_steps.rb on lines 1..78
      lib/generators/voluntary/product_dummy/templates/features/step_definitions/factory_steps.rb on lines 1..78

      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 261.

      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 3 locations. Consider refactoring.
      Open

      module FactoryMethods
        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
          
      dummy/features/step_definitions/factory_steps.rb on lines 1..78
      lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb on lines 1..78

      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 261.

      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 3 locations. Consider refactoring.
      Open

      module FactoryMethods
        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
          
      Severity: Major
      Found in dummy/features/step_definitions/factory_steps.rb and 2 other locations - About 1 day to fix
      lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb on lines 1..78
      lib/generators/voluntary/product_dummy/templates/features/step_definitions/factory_steps.rb on lines 1..78

      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 261.

      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

      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

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

                        if (winnerId === _this.currentMatch['winner'] && loserId === _this.otherCompetitorOfMatch(_this.currentMatch, _this.currentMatch['winner'])) {
                          _this.matches[index]['auto_winner_recursion'] = false;
                          _this.matches[index]['auto_winner_reason'] = 'loser has been defeated because he loses against the loser <sup>[1]</sup> of last match';
                        } else {
                          _this.matches[index]['auto_winner_recursion'] = true;
            app/assets/javascripts/voluntary/lib/jquery-competitive_list.js on lines 370..376

            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 128.

            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

                            if (winnerId === _this.currentMatch['winner'] && loserId === _this.otherCompetitorOfMatch(_this.currentMatch, _this.currentMatch['winner'])) {
                              _this.matches[index]['auto_winner_recursion'] = false;
                              _this.matches[index]['auto_winner_reason'] = "loser of last match has been defeated by outmatched competitor of<br/>winner <sup>[1]</sup>";
                            } else {
                              _this.matches[index]['auto_winner_recursion'] = true;
            app/assets/javascripts/voluntary/lib/jquery-competitive_list.js on lines 328..334

            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 128.

            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 3 locations. Consider refactoring.
            Open

            class TestMails
              class << self
            
                attr_accessor :user_identity
            
            
            dummy/features/step_definitions/email_steps.rb on lines 48..83
            lib/generators/voluntary/product_dummy/templates/features/step_definitions/email_steps.rb on lines 48..83

            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 153.

            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 3 locations. Consider refactoring.
            Open

            class TestMails
              class << self
            
                attr_accessor :user_identity
            
            
            Severity: Major
            Found in dummy/features/step_definitions/email_steps.rb and 2 other locations - About 4 hrs to fix
            lib/generators/voluntary/install/templates/features/step_definitions/email_steps.rb on lines 48..83
            lib/generators/voluntary/product_dummy/templates/features/step_definitions/email_steps.rb on lines 48..83

            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 153.

            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 3 locations. Consider refactoring.
            Open

            class TestMails
              class << self
            
                attr_accessor :user_identity
            
            
            dummy/features/step_definitions/email_steps.rb on lines 48..83
            lib/generators/voluntary/install/templates/features/step_definitions/email_steps.rb on lines 48..83

            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 153.

            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 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

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

                    module UserCukeHelpers
                    
                      # creates a new user object from the factory with some default attributes
                      # and the given override attributes, adds the standard aspects to it
                      # and returns it
                    Severity: Major
                    Found in dummy/features/support/user_cuke_helpers.rb and 1 other location - About 3 hrs to fix
                    lib/generators/voluntary/product_dummy/templates/features/support/user_cuke_helpers.rb on lines 1..73

                    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 122.

                    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

                    module UserCukeHelpers
                    
                      # creates a new user object from the factory with some default attributes
                      # and the given override attributes, adds the standard aspects to it
                      # and returns it
                    dummy/features/support/user_cuke_helpers.rb on lines 1..73

                    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 122.

                    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