volontariat/voluntary

View on GitHub

Showing 242 of 242 total issues

Function locationpicker has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.locationpicker = function( options, params ) {
        if (typeof options == 'string') { // Command provided
            var _targetDomElement = this.get(0);
            // Plug-in is not applied - nothing to do.
            if (!isPluginApplied(_targetDomElement)) return;

    Method included has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.included(base)
        base.extend ClassMethods
        
        base.class_eval do
          include Model::MongoDb::StateVersionAttributes
    Severity: Minor
    Found in app/models/state_machines/task.rb - About 3 hrs 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 buildBase64 has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function buildBase64(key) {
        var encodeAscii, decodeAscii;
    
        function catchEncodingError(fn) {
          return function(str) {
    Severity: Major
    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 3 hrs to fix

      Method create_from_table has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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 create_from_table has a Cognitive Complexity of 23 (exceeds 5 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

      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 create_from_table has a Cognitive Complexity of 23 (exceeds 5 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

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

        function buildDateMethods() {
          extendSimilar(date, DateUnits, function(methods, u, i) {
            var name = u.name, caps = simpleCapitalize(name), since, until;
            u.addMethod = 'add' + caps + 's';
      
      
      Severity: Major
      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 3 hrs to fix

        Function multiselectable has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          $.fn.multiselectable = function(options) {
            if (!options) {
              options = {}
            }
            options = $.extend({}, $.fn.multiselectable.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 3 locations. Consider refactoring.
          Open

          Given %r{^that (.+) has the following (.+):$} do |parent, child, table|
            child= child.gsub(/\W+/,'_')
            parent = parent.gsub(/\W+/,'_').downcase.sub(/^_/, '')
            parent_instance = instance_variable_get("@#{parent}")
            parent_class = parent_instance.class
          Severity: Major
          Found in dummy/features/step_definitions/factory_steps.rb and 2 other locations - About 3 hrs to fix
          lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb on lines 96..119
          lib/generators/voluntary/product_dummy/templates/features/step_definitions/factory_steps.rb on lines 96..119

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

          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

          Given %r{^that (.+) has the following (.+):$} do |parent, child, table|
            child= child.gsub(/\W+/,'_')
            parent = parent.gsub(/\W+/,'_').downcase.sub(/^_/, '')
            parent_instance = instance_variable_get("@#{parent}")
            parent_class = parent_instance.class
          dummy/features/step_definitions/factory_steps.rb on lines 96..119
          lib/generators/voluntary/product_dummy/templates/features/step_definitions/factory_steps.rb on lines 96..119

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

          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

          Given %r{^that (.+) has the following (.+):$} do |parent, child, table|
            child= child.gsub(/\W+/,'_')
            parent = parent.gsub(/\W+/,'_').downcase.sub(/^_/, '')
            parent_instance = instance_variable_get("@#{parent}")
            parent_class = parent_instance.class
          dummy/features/step_definitions/factory_steps.rb on lines 96..119
          lib/generators/voluntary/install/templates/features/step_definitions/factory_steps.rb on lines 96..119

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

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

            function init (converter) {
              function api (key, value, attributes) {
                var result;
          
                // Write
          Severity: Major
          Found in app/assets/javascripts/voluntary/lib/jquery.cookie.js - About 3 hrs to fix

            Method table_cell has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                if params[:event] && params[:event].keys.select{|k| ['cancel', 'skip'].include?(k)}.any?
                  send(params[:event].keys.first)
                  return
                end
            Severity: Minor
            Found in app/controllers/workflow/tasks_controller.rb - About 2 hrs 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 nextMatch has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  CompetitiveList.prototype.nextMatch = function(from_start) {
                    var autoWinnerMatchesHtml, competitorStrings, html, i, modalBodyHtml, modalFooterHtml, modalTitle, radioButtons, rows;
                    autoWinnerMatchesHtml = '';
                    if (this.currentAutoWinnerMatches.length > 0) {
                      this.currentMatch = this.matches[this.currentMatchIndex];
            Severity: Major
            Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 2 hrs to fix

              Function setupInputListenersInput has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function setupInputListenersInput(inputBinding, gmapContext) {
                      if (inputBinding) {
                          if (inputBinding.radiusInput){
                              inputBinding.radiusInput.on("change", function(e) {
                                  if (!e.originalEvent) { return }

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

                      when :products 
                        Proc.new do |primary, options|
                          primary.item :products, I18n.t('products.index.title'), products_path do |products|
                            products.item :new, I18n.t('general.new'), new_product_path
                            
                Severity: Major
                Found in lib/voluntary/navigation.rb and 1 other location - About 2 hrs to fix
                lib/voluntary/navigation.rb on lines 105..122

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

                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

                      when :organizations
                        Proc.new do |primary, options|
                          primary.item :organizations, I18n.t('organizations.index.title'), organizations_path do |organizations|
                            organizations.item :new, I18n.t('general.new'), new_organization_path
                            
                Severity: Major
                Found in lib/voluntary/navigation.rb and 1 other location - About 2 hrs to fix
                lib/voluntary/navigation.rb on lines 82..100

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

                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

                module NavigationHelpers
                  # Maps a name to a path. Used by the
                  #
                  #   When /^I go to (.+)$/ do |page_name|
                  #
                lib/generators/voluntary/install/templates/features/support/paths.rb on lines 6..80

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

                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

                module NavigationHelpers
                  # Maps a name to a path. Used by the
                  #
                  #   When /^I go to (.+)$/ do |page_name|
                  #
                lib/generators/voluntary/product_dummy/templates/features/support/paths.rb on lines 6..80

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

                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