spec/features/proposals_spec.rb

Summary

Maintainability
F
1 wk
Test Coverage

File proposals_spec.rb has 1385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

feature 'Proposals' do

  scenario 'Disabled with a feature flag' do
Severity: Major
Found in spec/features/proposals_spec.rb - About 3 days to fix

    TODO found
    Open

      # TODO i18n : broken because of test locale change
    Severity: Minor
    Found in spec/features/proposals_spec.rb by fixme

    TODO found
    Open

      # TODO i18n : broken because of test locale change
    Severity: Minor
    Found in spec/features/proposals_spec.rb by fixme

    TODO found
    Open

      # TODO i18n : broken because of test locale change
    Severity: Minor
    Found in spec/features/proposals_spec.rb by fixme

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

          context "Search by author type" do
    
            xscenario "Public employee", :js do
              ana = create :user, official_level: 1
              john = create :user, official_level: 2
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 day to fix
    spec/features/debates_spec.rb on lines 593..706

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

    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

        context 'Recommendations' do
    
          let!(:best_proposal)   { create(:proposal, title: 'Best',   cached_votes_up: 10, tag_list: 'Sport') }
          let!(:medium_proposal) { create(:proposal, title: 'Medium', cached_votes_up: 5,  tag_list: 'Sport') }
          let!(:worst_proposal)  { create(:proposal, title: 'Worst',  cached_votes_up: 1,  tag_list: 'Sport') }
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 day to fix
    spec/features/debates_spec.rb on lines 408..527

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

    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

      context "Filter" do
    
        context "By geozone" do
    
          background do
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 5 hrs to fix
    spec/features/debates_spec.rb on lines 1011..1067

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

    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 "Reorder by recommendations results maintaing search" do
          Setting['feature.user.recommendations'] = true
          Setting['feature.user.recommendations_on_proposals'] = true
    
          user = create(:user, recommended_proposals: true)
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 3 hrs to fix
    spec/features/debates_spec.rb on lines 941..969

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

    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 "Reorder results maintaing search", :js do
          proposal1 = create(:proposal, title: "Show you got",      cached_votes_up: 10,  created_at: 1.week.ago)
          proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1,   created_at: 1.month.ago)
          proposal3 = create(:proposal, title: "Show you got",      cached_votes_up: 100, created_at: Time.current)
          proposal4 = create(:proposal, title: "Do not display",    cached_votes_up: 1,   created_at: 1.week.ago)
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 3 hrs to fix
    spec/features/debates_spec.rb on lines 921..937

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

    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 "Order by relevance by default", :js do
          proposal1 = create(:proposal, title: "Show you got",      cached_votes_up: 10)
          proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1)
          proposal3 = create(:proposal, title: "Show you got",      cached_votes_up: 100)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 2 hrs to fix
    spec/features/debates_spec.rb on lines 903..917

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

    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

      xscenario 'JS injection is prevented but safe html is respected' do
        author = create(:user)
        login_as(author)
    
        visit new_proposal_path
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/custom/features/proposals_spec.rb on lines 14..35

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

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

              scenario "Last year", :js do
                proposal1 = create(:proposal, created_at: 300.days.ago)
                proposal2 = create(:proposal, created_at: 350.days.ago)
                proposal3 = create(:proposal, created_at: 370.days.ago)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 3 other locations - About 1 hr to fix
    spec/features/proposals_spec.rb on lines 1165..1181
    spec/features/proposals_spec.rb on lines 1185..1201
    spec/features/proposals_spec.rb on lines 1205..1221

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

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

              scenario "Last month", :js do
                proposal1 = create(:proposal, created_at: 10.days.ago)
                proposal2 = create(:proposal, created_at: 20.days.ago)
                proposal3 = create(:proposal, created_at: 33.days.ago)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 3 other locations - About 1 hr to fix
    spec/features/proposals_spec.rb on lines 1165..1181
    spec/features/proposals_spec.rb on lines 1185..1201
    spec/features/proposals_spec.rb on lines 1225..1241

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

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

              scenario "Last week", :js do
                proposal1 = create(:proposal, created_at: 1.day.ago)
                proposal2 = create(:proposal, created_at: 5.days.ago)
                proposal3 = create(:proposal, created_at: 8.days.ago)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 3 other locations - About 1 hr to fix
    spec/features/proposals_spec.rb on lines 1165..1181
    spec/features/proposals_spec.rb on lines 1205..1221
    spec/features/proposals_spec.rb on lines 1225..1241

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

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

              scenario "Last day", :js do
                proposal1 = create(:proposal, created_at: 1.minute.ago)
                proposal2 = create(:proposal, created_at: 1.hour.ago)
                proposal3 = create(:proposal, created_at: 2.days.ago)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 3 other locations - About 1 hr to fix
    spec/features/proposals_spec.rb on lines 1185..1201
    spec/features/proposals_spec.rb on lines 1205..1221
    spec/features/proposals_spec.rb on lines 1225..1241

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

    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 'Search by text' do
            proposal1 = create(:proposal, title: "Get Schwifty")
            proposal2 = create(:proposal, title: "Schwifty Hello")
            proposal3 = create(:proposal, title: "Do not show me")
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/features/debates_spec.rb on lines 536..553

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

    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 "Search by text", :js do
            proposal1 = create(:proposal, title: "Get Schwifty")
            proposal2 = create(:proposal, title: "Schwifty Hello")
            proposal3 = create(:proposal, title: "Do not show me")
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/features/debates_spec.rb on lines 572..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 61.

    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 'Responsible name field is not shown for verified users' do
        author = create(:user, :level_two)
        login_as(author)
    
        visit new_proposal_path
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/custom/features/proposals_spec.rb on lines 111..130

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

    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 "Unflagging", :js do
        user = create(:user)
        proposal = create(:proposal)
        Flag.flag(user, proposal)
    
    
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/features/debates_spec.rb on lines 333..348

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

    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 "Flagging", :js do
        user = create(:user)
        proposal = create(:proposal)
    
        login_as(user)
    Severity: Major
    Found in spec/features/proposals_spec.rb and 1 other location - About 1 hr to fix
    spec/features/debates_spec.rb on lines 316..330

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

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

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

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

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

    Refactorings

    Further Reading

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

              within "#js-advanced-search" do
                expect(page).to have_select('advanced_search[date_min]', selected: 'Customized')
                expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime('%d/%m/%Y')}']")
                expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime('%d/%m/%Y')}']")
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 2 other locations - About 35 mins to fix
    spec/features/budgets/investments_spec.rb on lines 450..453
    spec/features/debates_spec.rb on lines 893..896

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

    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 'After a search do not show featured proposals' do
          featured_proposals = create_featured_proposals
          proposal = create(:proposal, title: "Abcdefghi")
    
          visit proposals_path
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 35 mins to fix
    spec/features/debates_spec.rb on lines 972..983

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

    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

          proposals.each do |proposal|
            within('#proposals') do
              expect(page).to have_content proposal.title
              expect(page).to have_content proposal.summary
              expect(page).to have_css("a[href='#{proposal_path(proposal)}']", text: proposal.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 30 mins to fix
    spec/features/debates_spec.rb on lines 33..37

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

    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 'Update should not be posible if logged user is not the author' do
        proposal = create(:proposal)
        expect(proposal).to be_editable
        login_as(create(:user))
    
    
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 30 mins to fix
    spec/features/debates_spec.rb on lines 262..270

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

    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 'When path does not match the friendly url' do
          proposal = create(:proposal)
    
          right_path = proposal_path(proposal)
          old_path = "#{proposals_path}/#{proposal.id}-something-else"
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 25 mins to fix
    spec/features/debates_spec.rb on lines 129..137

    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

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

              within "#js-advanced-search" do
                expect(page).to have_selector("input[name='search'][value='Schwifty']")
                expect(page).to have_select('advanced_search[official_level]', selected: Setting['official_level_1_name'])
                expect(page).to have_select('advanced_search[date_min]', selected: 'Last 24 hours')
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 2 other locations - About 20 mins to fix
    spec/features/budgets/investments_spec.rb on lines 432..435
    spec/features/debates_spec.rb on lines 877..880

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

    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 'Conflictive' do
        good_proposal = create(:proposal)
        conflictive_proposal = create(:proposal, :conflictive)
    
        visit proposal_path(conflictive_proposal)
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 20 mins to fix
    spec/features/debates_spec.rb on lines 988..996

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

    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 'Errors on update' do
        proposal = create(:proposal)
        login_as(proposal.author)
    
        visit edit_proposal_path(proposal)
    Severity: Minor
    Found in spec/features/proposals_spec.rb and 1 other location - About 15 mins to fix
    spec/features/debates_spec.rb on lines 305..313

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

    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

    Do not set an RSpec expectation on current_path in Capybara feature specs - instead, use the have_current_path matcher on page (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation)
    Open

          expect(current_path).to eq(new_proposal_path)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

        expect(page).not_to have_content "This proposal has been flagged as inappropriate by several users."
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal2.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

        expect(page).to have_css "meta[property='og:title'][content=\"#{proposal.title}\"]", visible: false
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

        expect(page).not_to have_content 'You can also see more information about improving your campaign'
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          let!(:medium_proposal) { create(:proposal, title: 'Medium', cached_votes_up: 5,  tag_list: 'Sport') }
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

            @proposal3 = create(:proposal, geozone: @new_york)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

              proposal1 = create(:proposal, title: "Get Schwifty",   author: ana,  created_at: 1.minute.ago)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [110/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1,   created_at: 1.month.ago)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal2.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

            expect(page).to have_content('Recommendations for proposals are now disabled for this account')
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).not_to have_content(@proposal3.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          fill_in 'proposal_retired_explanation', with: 'There are three other better proposals with the same subject'
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [109/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal4 = create(:proposal, title: "Do not display",    cached_votes_up: 1,   created_at: 1.week.ago)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    %w-literals should be delimited by [ and ]. (https://github.com/bbatsov/ruby-style-guide#percent-literal-braces)
    Open

          orders = %w{hot_score confidence_score created_at relevance}
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    This cop enforces the consistent usage of %-literal delimiters.

    Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

    Example:

    # Style/PercentLiteralDelimiters:
    #   PreferredDelimiters:
    #     default: '[]'
    #     '%i':    '()'
    
    # good
    %w[alpha beta] + %i(gamma delta)
    
    # bad
    %W(alpha #{beta})
    
    # bad
    %I(alpha beta)

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

            @proposal2 = create(:proposal, geozone: @california)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

            visit proposal_path(@proposal1)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

        expect(page).to have_css "meta[name='twitter:title'][content=\"#{proposal.title}\"]", visible: false
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [101/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

                expect(page).to have_content "This proposal has been archived and can't collect supports"
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [128/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

                expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime('%d/%m/%Y')}']")
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal1 = create(:proposal, title: "Show you got",      cached_votes_up: 10,  tag_list: "Sport")
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [131/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

        js_injection_string = "<script>alert('hey')</script> <a href=\"javascript:alert('surprise!')\">click me<a/> http://example.org"
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          medium_proposal = create(:proposal, title: 'Medium proposal', created_at: Time.current - 1.hour)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          let!(:best_proposal)   { create(:proposal, title: 'Best',   cached_votes_up: 10, tag_list: 'Sport') }
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          let!(:worst_proposal)  { create(:proposal, title: 'Worst',  cached_votes_up: 1,  tag_list: 'Sport') }
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1,   tag_list: "Sport")
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal1.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Trailing whitespace detected. (https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace)
    Open

      
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).not_to have_content(@proposal3.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

            @proposal1 = create(:proposal, geozone: @california)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal1.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).not_to have_content(@proposal3.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

              proposal2 = create(:proposal, title: "Hello Schwifty", author: john, created_at: 2.days.ago)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [118/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

                expect(page).to have_select('advanced_search[official_level]', selected: Setting['official_level_1_name'])
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal2.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal3 = create(:proposal, title: "Show you got",      cached_votes_up: 100, created_at: Time.current)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [129/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

                expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime('%d/%m/%Y')}']")
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [109/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal1 = create(:proposal, title: "Show you got",      cached_votes_up: 10,  created_at: 1.week.ago)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
    Open

              expect(page).to have_content(@proposal1.title)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          archived_proposal = create(:proposal, :archived, :with_confidence_score, cached_votes_up: 10000)
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Line is too long. [115/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          proposal3 = create(:proposal, title: "Do not display with same tag", cached_votes_up: 100, tag_list: "Sport")
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    Prefer not_to over to_not. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot)
    Open

              expect(page).to_not have_content proposal.summary
    Severity: Minor
    Found in spec/features/proposals_spec.rb by rubocop

    There are no issues that match your filters.

    Category
    Status