volontariat/voluntary

View on GitHub

Showing 242 of 242 total issues

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

        return $(document.body).on('click', '#bootstrap_modal .select_winner_button', (function(_this) {
          return function(event) {
            event.preventDefault();
            return _this.appointWinnerOfMatchByInput();
          };
app/assets/javascripts/voluntary/lib/jquery-competitive_list.js on lines 55..60

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

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

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

                  begin
                    _routes = Dummy::Application.routes
                    _routes.disable_clear_and_finalize = true
                    _routes.clear!
                    
                  Severity: Major
                  Found in dummy/features/support/integration_sessions_controller.rb and 2 other locations - About 55 mins to fix
                  lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb on lines 15..30
                  lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb on lines 15..30

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

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

                  begin
                    _routes = Dummy::Application.routes
                    _routes.disable_clear_and_finalize = true
                    _routes.clear!
                    
                  dummy/features/support/integration_sessions_controller.rb on lines 17..32
                  lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb on lines 15..30

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

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

                  begin
                    _routes = Volontariat::Application.routes
                    _routes.disable_clear_and_finalize = true
                    _routes.clear!
                    
                  dummy/features/support/integration_sessions_controller.rb on lines 17..32
                  lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb on lines 15..30

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

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

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

                                        GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), $(this).val()), function(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 173..176
                    app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js on lines 223..226

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

                    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