oneclickorgs/one-click-orgs

View on GitHub
app/models/constitution_proposal_bundle.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method build_proposals_for_coop has a Cognitive Complexity of 134 (exceeds 5 allowed). Consider refactoring.
Open

  def build_proposals_for_coop
    ability = Ability.new(proposer)

    # Organisation name
    if organisation.name != organisation_name
Severity: Minor
Found in app/models/constitution_proposal_bundle.rb - About 2 days 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 build_proposals_for_coop has 421 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_proposals_for_coop
    ability = Ability.new(proposer)

    # Organisation name
    if organisation.name != organisation_name
Severity: Major
Found in app/models/constitution_proposal_bundle.rb - About 2 days to fix

    File constitution_proposal_bundle.rb has 593 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'one_click_orgs/model_wrapper'
    
    # Provides an ActiveModel like interface to a bundle of ConstitutionProposals.
    # The attributes exposed are the constitution settings themselves (e.g. organisation_name,
    # voting_period, etc.), plus a single 'proposer' attribute.
    Severity: Major
    Found in app/models/constitution_proposal_bundle.rb - About 1 day to fix

      Method after_initialize has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

        def after_initialize
          # Load existing settings from organisation, if given, but don't
          # overwrite new settings that have been passed directly in as attributes.
          if organisation
            case organisation
      Severity: Minor
      Found in app/models/constitution_proposal_bundle.rb - About 5 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 build_proposals_for_association has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def build_proposals_for_association
          # Organisation name
          if organisation.name != organisation_name
            proposal = (organisation.change_text_proposals.new(
              :name => 'organisation_name',
      Severity: Minor
      Found in app/models/constitution_proposal_bundle.rb - About 4 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 build_proposals_for_association has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def build_proposals_for_association
          # Organisation name
          if organisation.name != organisation_name
            proposal = (organisation.change_text_proposals.new(
              :name => 'organisation_name',
      Severity: Major
      Found in app/models/constitution_proposal_bundle.rb - About 3 hrs to fix

        Method after_initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def after_initialize
            # Load existing settings from organisation, if given, but don't
            # overwrite new settings that have been passed directly in as attributes.
            if organisation
              case organisation
        Severity: Minor
        Found in app/models/constitution_proposal_bundle.rb - About 1 hr to fix

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

              if organisation.max_supporter_directors != max_supporter_directors.to_i
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_integer_resolutions.build(
                    :name => 'max_supporter_directors',
                    :value => max_supporter_directors.to_i,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 4 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 488..510
          app/models/constitution_proposal_bundle.rb on lines 514..536
          app/models/constitution_proposal_bundle.rb on lines 566..588
          app/models/constitution_proposal_bundle.rb on lines 592..614

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

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

              if organisation.max_user_directors != max_user_directors.to_i
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_integer_resolutions.build(
                    :name => 'max_user_directors',
                    :value => max_user_directors.to_i,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 4 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 514..536
          app/models/constitution_proposal_bundle.rb on lines 540..562
          app/models/constitution_proposal_bundle.rb on lines 566..588
          app/models/constitution_proposal_bundle.rb on lines 592..614

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

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

              if organisation.max_consumer_directors != max_consumer_directors.to_i
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_integer_resolutions.build(
                    :name => 'max_consumer_directors',
                    :value => max_consumer_directors.to_i,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 4 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 488..510
          app/models/constitution_proposal_bundle.rb on lines 514..536
          app/models/constitution_proposal_bundle.rb on lines 540..562
          app/models/constitution_proposal_bundle.rb on lines 566..588

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

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

              if organisation.max_employee_directors != max_employee_directors.to_i
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_integer_resolutions.build(
                    :name => 'max_employee_directors',
                    :value => max_employee_directors.to_i,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 4 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 488..510
          app/models/constitution_proposal_bundle.rb on lines 540..562
          app/models/constitution_proposal_bundle.rb on lines 566..588
          app/models/constitution_proposal_bundle.rb on lines 592..614

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

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

              if organisation.max_producer_directors != max_producer_directors.to_i
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_integer_resolutions.build(
                    :name => 'max_producer_directors',
                    :value => max_producer_directors.to_i,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 4 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 488..510
          app/models/constitution_proposal_bundle.rb on lines 514..536
          app/models/constitution_proposal_bundle.rb on lines 540..562
          app/models/constitution_proposal_bundle.rb on lines 592..614

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

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

              if (organisation.common_ownership && !new_common_ownership_value) || (!organisation.common_ownership && new_common_ownership_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'common_ownership',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 460..484

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

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

              if (organisation.user_members && !new_user_members_value) || (!organisation.user_members && new_user_members_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'user_members',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 460..484
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

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

              if (organisation.producer_members && !new_producer_members_value) || (!organisation.producer_members && new_producer_members_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'producer_members',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 460..484
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

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

              if (organisation.supporter_members && !new_supporter_members_value) || (!organisation.supporter_members && new_supporter_members_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'supporter_members',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 460..484
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

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

              if (organisation.employee_members && !new_employee_members_value) || (!organisation.employee_members && new_employee_members_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'employee_members',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 460..484
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

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

              if (organisation.consumer_members && !new_consumer_members_value) || (!organisation.consumer_members && new_consumer_members_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'consumer_members',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 460..484
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

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

              if (organisation.single_shareholding && !new_single_shareholding_value) || (!organisation.single_shareholding && new_single_shareholding_value) # Bit verbose, to cope with null values
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_boolean_resolutions.build(
                    :title => title,
                    :name => 'single_shareholding',
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 6 other locations - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 294..318
          app/models/constitution_proposal_bundle.rb on lines 327..351
          app/models/constitution_proposal_bundle.rb on lines 360..384
          app/models/constitution_proposal_bundle.rb on lines 393..417
          app/models/constitution_proposal_bundle.rb on lines 426..450
          app/models/constitution_proposal_bundle.rb on lines 626..650

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

          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 organisation.registered_office_address != registered_office_address
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_text_resolutions.build(
                    :name => 'registered_office_address',
                    :value => registered_office_address,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 1 other location - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 209..229

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

          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 organisation.name != organisation_name
                proposal = if ability.can?(:create, Resolution)
                  organisation.change_text_resolutions.build(
                    :name => 'organisation_name',
                    :value => organisation_name,
          Severity: Major
          Found in app/models/constitution_proposal_bundle.rb and 1 other location - About 1 hr to fix
          app/models/constitution_proposal_bundle.rb on lines 261..281

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

          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

              if current_system != proposed_system
                proposal = (organisation.change_voting_system_proposals.new(
                  :proposal_type => 'constitution',
                  :proposed_system => proposed_system.simple_name
                ))
          Severity: Minor
          Found in app/models/constitution_proposal_bundle.rb and 2 other locations - About 25 mins to fix
          app/models/constitution_proposal_bundle.rb on lines 144..153
          app/models/constitution_proposal_bundle.rb on lines 161..170

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

          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 organisation.name != organisation_name
                proposal = (organisation.change_text_proposals.new(
                  :name => 'organisation_name',
                  :value => organisation_name
                ))
          Severity: Minor
          Found in app/models/constitution_proposal_bundle.rb and 1 other location - About 25 mins to fix
          app/models/constitution_proposal_bundle.rb on lines 104..113

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

          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

              if current_system != proposed_system
                proposal = (organisation.change_voting_system_proposals.new(
                  :proposal_type => 'membership',
                  :proposed_system => proposed_system.simple_name
                ))
          Severity: Minor
          Found in app/models/constitution_proposal_bundle.rb and 2 other locations - About 25 mins to fix
          app/models/constitution_proposal_bundle.rb on lines 144..153
          app/models/constitution_proposal_bundle.rb on lines 178..187

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

          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

              if current_system != proposed_system
                proposal = (organisation.change_voting_system_proposals.new(
                  :proposal_type => 'general',
                  :proposed_system => proposed_system.simple_name
                ))
          Severity: Minor
          Found in app/models/constitution_proposal_bundle.rb and 2 other locations - About 25 mins to fix
          app/models/constitution_proposal_bundle.rb on lines 161..170
          app/models/constitution_proposal_bundle.rb on lines 178..187

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

          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 organisation.objectives != objectives
                proposal = (organisation.change_text_proposals.new(
                  :name => 'organisation_objectives',
                  :value => objectives
                ))
          Severity: Minor
          Found in app/models/constitution_proposal_bundle.rb and 1 other location - About 25 mins to fix
          app/models/constitution_proposal_bundle.rb on lines 90..99

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

          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

          There are no issues that match your filters.

          Category
          Status