Showing 2,528 of 2,528 total issues
File translatable_spec.rb
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Admin edit translatable records", :admin do
before do
translatable.main_link_url = "https://consuldemocracy.org" if translatable.is_a?(Budget::Phase)
Class Budget
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Budget < ApplicationRecord
include Measurable
include Sluggable
include StatsVersionable
include Reportable
File user.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
class User < ApplicationRecord
include Verification
attribute :registering_from_web, default: false
devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable,
Similar blocks of code found in 2 locations. Consider refactoring. Open
scenario "Filtering by minimum number of votes" do
group_1 = create(:budget_group, budget: budget)
group_2 = create(:budget_group, budget: budget)
parks = create(:budget_heading, group: group_1)
roads = create(:budget_heading, group: group_2)
- 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 165.
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
scenario "Filtering by maximum number of votes" do
group_1 = create(:budget_group, budget: budget)
group_2 = create(:budget_group, budget: budget)
parks = create(:budget_heading, group: group_1)
roads = create(:budget_heading, group: group_2)
- 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 165.
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
File budgets_spec.rb
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Admin budgets", :admin do
it_behaves_like "nested imageable",
"budget",
File relations_spec.rb
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "SDG Relations" do
before do
login_as(create(:administrator).user)
Class Poll
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Poll < ApplicationRecord
require_dependency "poll/answer"
include Imageable
acts_as_paranoid column: :hidden_at
File users_spec.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Users" do
describe "Show (public page)" do
let(:user) { create(:user) }
File tenant_spec.rb
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
require "active_storage/service/disk_service"
describe Tenant do
describe ".resolve_host" do
Class Proposal
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Proposal < ApplicationRecord
include Flaggable
include Taggable
include Conflictable
include Measurable
Method defaults
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
def defaults
{
"feature.featured_proposals": nil,
"feature.facebook_login": true,
"feature.google_login": true,
File draft_versions_spec.rb
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Legislation Draft Versions" do
let(:user) { create(:user) }
let(:administrator) do
File budgets_spec.rb
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Budgets" do
let(:budget) { create(:budget) }
let(:level_two_user) { create(:user, :level_two) }
Similar blocks of code found in 2 locations. Consider refactoring. Open
context "Debates" do
let(:debate) { create(:debate) }
let(:remote_translation) do
create(:remote_translation, remote_translatable: debate, locale: :es)
end
- 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 145.
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
context "Budget Investments" do
let(:budget_investment) { create(:budget_investment) }
let(:remote_translation) do
create(:remote_translation, remote_translatable: budget_investment, locale: :es)
end
- 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 145.
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
Method initialize
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
merge Abilities::Moderation.new(user)
merge Abilities::SDG::Manager.new(user)
can :restore, Comment
Similar blocks of code found in 2 locations. Consider refactoring. Open
it "does not delete other machine learning generated data" do
create(:related_content, :proposals, :from_machine_learning)
create(:related_content, :budget_investments, :from_machine_learning)
create(:tagging, tag: create(:tag))
- 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 143.
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
it "does not delete other machine learning generated data" do
create(:related_content, :proposals, :from_machine_learning)
create(:related_content, :budget_investments, :from_machine_learning)
create(:tagging, tag: create(:tag))
- 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 143.
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
File processes_spec.rb
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Legislation" do
let!(:administrator) { create(:administrator).user }