File budget_investments_spec.rb
has 1070 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Admin budget investments' do
let(:budget) { create(:budget) }
Identical blocks of code found in 2 locations. Consider refactoring. Open
scenario "Showing the valuating checkbox" do
investment1 = create(:budget_investment, budget: budget, visible_to_valuators: true)
investment2 = create(:budget_investment, budget: budget, visible_to_valuators: false)
investment1.valuators << create(:valuator)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
scenario "Showing the valuating checkbox" do
investment1 = create(:budget_investment, budget: budget, visible_to_valuators: true)
investment2 = create(:budget_investment, budget: budget, visible_to_valuators: false)
investment1.valuators << create(:valuator)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
within("#budget_investment_#{budget_investment2.id}") do
expect(page).to have_content("No admin assigned")
expect(page).to have_content("Valuator Olga")
expect(page).to have_content("Valuator Miriam")
expect(page).to have_content("No valuation groups assigned")
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, budget: budget, title: 'More schools', tag_list: 'Education')
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('A Second Investment').to appear_before('C Third Investment')
- Exclude checks
Use let
instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable) Open
login_as(@admin.user)
- Exclude checks
Line is too long. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:unfeasible_bi) { create(:budget_investment, :unfeasible, budget: budget, title: "Unfeasible project") }
- Exclude checks
Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, budget: budget, title: 'Educate the children', tag_list: 'Education')
- Exclude checks
Line is too long. [101/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: parks, cached_votes_up: 99, title: "Park with 99 supports")
- Exclude checks
Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuated = create(:budget_investment, budget: budget, title: "Old idea", valuation_finished: true)
- Exclude checks
Line is too long. [127/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuating = create(:budget_investment, budget: budget, title: "Ongoing valuation", administrator: create(:administrator))
- Exclude checks
Line is too long. [127/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
"Budget Heading,Feasible (€99),Yes,Yes,Yes,#{first_investment.author.username}\n#{second_investment.id},"\
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('B First Investment').to appear_before('A Second Investment')
- Exclude checks
Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, title: "Plant trees", budget: budget, group: group2, heading: group2_heading1)
- Exclude checks
Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
administrator = create(:administrator, user: create(:user, username: 'Marta', email: 'marta@admins.org'))
- Exclude checks
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator3 = create(:valuator, user: create(:user, username: 'Val', email: 'v3@valuators.org'))
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('C Third Investment').to appear_before('A Second Investment')
- Exclude checks
Line is too long. [125/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:feasible_vf_bi) { create(:budget_investment, :feasible, :finished, budget: budget, title: "Feasible, VF project") }
- Exclude checks
Line is too long. [170/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
expect(page).to have_content 'The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects'
- Exclude checks
Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: roads, cached_votes_up: 100, title: "Road with 100 supports")
- Exclude checks
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator2 = create(:valuator, user: create(:user, username: 'Valerian', email: 'v2@valuators.org'))
- Exclude checks
Line is too long. [110/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:feasible_bi) { create(:budget_investment, :feasible, budget: budget, title: "Feasible project") }
- Exclude checks
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:winner_bi) { create(:budget_investment, :winner, budget: budget, title: "Winner project") }
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('A Second Investment').to appear_before('B First Investment')
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('A Second Investment').to appear_before('B First Investment')
- Exclude checks
Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: streets, cached_votes_up: 300, title: "Street with 300 supports")
- Exclude checks
Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, title: "Change name", budget: budget, group: group1, heading: group1_heading2)
- Exclude checks
Line is too long. [122/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
assigned = create(:budget_investment, title: "Assigned idea", budget: budget, administrator: create(:administrator))
- Exclude checks
Provide the actual you are testing to expect(...)
. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual) Open
expect('B First Investment').to appear_before('C Third Investment')
- Exclude checks
Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator1 = create(:valuator, user: create(:user, username: 'Olga'), description: 'Valuator Olga')
- Exclude checks
Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, title: "Realocate visitors", budget: budget, administrator: administrator)
- Exclude checks
Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: roads, cached_votes_up: 199, title: "Road with 199 supports")
- Exclude checks
Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: streets, cached_votes_up: 200, title: "Street with 200 supports")
- Exclude checks
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator = create(:valuator, user: create(:user, username: 'Rachel', email: 'rachel@valuators.org'))
- Exclude checks
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator1 = create(:valuator, user: create(:user, username: 'Valentina', email: 'v1@valuators.org'))
- Exclude checks
Line is too long. [108/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
valuator2 = create(:valuator, user: create(:user, username: 'Miriam'), description: 'Valuator Miriam')
- Exclude checks
Line is too long. [110/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:selected_bi) { create(:budget_investment, :selected, budget: budget, title: "Selected project") }
- Exclude checks
Line is too long. [101/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, heading: parks, cached_votes_up: 40, title: "Park with 40 supports")
- Exclude checks
Line is too long. [112/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
let!(:undecided_bi) { create(:budget_investment, :undecided, budget: budget, title: "Undecided project") }
- Exclude checks
Line is too long. [118/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
create(:budget_investment, title: "Realocate visitors", budget: budget, group: group1, heading: group1_heading1)
- Exclude checks