oneclickorgs/one-click-orgs

View on GitHub

Showing 43 of 108 total issues

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

  $('#change_meeting_notice_period_resolution_pass_immediately').change(function () {
    if ($('#change_meeting_notice_period_resolution_pass_immediately:checked').val() == '1') {
      $('.pass_immediately_true').show();
      $('.pass_immediately_false').hide();
    } else {
app/assets/javascripts/change_quorum_resolutions.js on lines 4..12

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

  $('#change_quorum_resolution_pass_immediately').change(function () {
    if ($('#change_quorum_resolution_pass_immediately:checked').val() == '1') {
      $('.pass_immediately_true').show();
      $('.pass_immediately_false').hide();
    } else {
Severity: Major
Found in app/assets/javascripts/change_quorum_resolutions.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/change_meeting_notice_period_resolutions.js on lines 21..29

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

  $('body.setup input#coop_name').keyup(function() {
    var text = $('input#coop_name').val();
    text = text.toLowerCase();
    // Regex to whitelist organisation name to generate a subdomain
    // Obviously, we still need to validate this in the app
Severity: Major
Found in app/assets/javascripts/coops_new.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/associations_new.js on lines 11..18

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

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

  $('body.setup input#association_name').keyup(function() {
    var text = $('input#association_name').val();
    text = text.toLowerCase();
    // Regex to whitelist organisation name to generate a subdomain
    // Obviously, we still need to validate this in the app
Severity: Major
Found in app/assets/javascripts/associations_new.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/coops_new.js on lines 5..12

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

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

  def notify_share_application(recipient, share_transaction)
    @recipient = recipient
    @share_transaction = share_transaction

    raise ArgumentError, "recipient and share_transaction must be passed" unless @recipient && @share_transaction
Severity: Minor
Found in app/mailers/share_transaction_mailer.rb and 1 other location - About 50 mins to fix
app/mailers/share_transaction_mailer.rb on lines 18..31

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

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

  def notify_share_withdrawal(recipient, share_transaction)
    @recipient = recipient
    @share_transaction = share_transaction

    raise ArgumentError, "recipient and share_transaction must be passed" unless @recipient && @share_transaction
Severity: Minor
Found in app/mailers/share_transaction_mailer.rb and 1 other location - About 50 mins to fix
app/mailers/share_transaction_mailer.rb on lines 2..15

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

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