AyuntamientoMadrid/participacion

View on GitHub
spec/system/dashboard/dashboard_spec.rb

Summary

Maintainability
C
1 day
Test Coverage

File dashboard_spec.rb has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rails_helper"

describe "Proposal's dashboard" do
  let(:proposal) { create(:proposal, :draft) }
  before { login_as(proposal.author) }
Severity: Minor
Found in spec/system/dashboard/dashboard_spec.rb - About 5 hrs to fix

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

        within "div#available-resources-section" do
          expect(page).to have_content("Polls")
          expect(page).to have_content("E-mail")
          expect(page).to have_content("Poster")
          expect(page).to have_content(available.title)
    Severity: Major
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 2 hrs to fix
    spec/system/dashboard/dashboard_spec.rb on lines 171..193

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        within "div#available-resources-section" do
          expect(page).to have_content("Polls")
          expect(page).to have_content("E-mail")
          expect(page).to have_content("Poster")
          expect(page).to have_content(available.title)
    Severity: Major
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 2 hrs to fix
    spec/system/dashboard/dashboard_spec.rb on lines 218..240

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

    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

        scenario "Not display tag 'new' on resouce when there is not new resources since last login" do
          resource = create(:dashboard_action, :resource, :active, day_offset: 0,
                                                                   published_proposal: false)
          proposal.author.update!(current_sign_in_at: Date.current)
    
    
    Severity: Minor
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 35 mins to fix
    spec/system/dashboard/dashboard_spec.rb on lines 527..535

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

    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

        scenario "Not display tag 'new' on proposed_action when there is not new since last login" do
          proposed_action = create(:dashboard_action, :proposed_action, :active, day_offset: 0,
                                                                                 published_proposal: false)
          proposal.author.update!(current_sign_in_at: Date.current)
    
    
    Severity: Minor
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 35 mins to fix
    spec/system/dashboard/dashboard_spec.rb on lines 504..512

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

    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

        scenario "Display tag 'new' on resouce when it is new for author since last login" do
          resource = create(:dashboard_action, :resource, :active, day_offset: 0,
                                                                   published_proposal: false)
    
          visit progress_proposal_dashboard_path(proposal)
    Severity: Minor
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 20 mins to fix
    spec/system/dashboard/dashboard_spec.rb on lines 516..523

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

    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

        scenario "Display tag 'new' on proposed_action when it is new for author since last login" do
          proposed_action = create(:dashboard_action, :proposed_action, :active, day_offset: 0,
                                                                                 published_proposal: false)
    
          visit progress_proposal_dashboard_path(proposal)
    Severity: Minor
    Found in spec/system/dashboard/dashboard_spec.rb and 1 other location - About 20 mins to fix
    spec/system/dashboard/dashboard_spec.rb on lines 493..500

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

    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