Showing 4,066 of 4,066 total issues

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

  context "Debates" do
    scenario "Shows moderation activity on debates", :js do
      debate = create(:debate)

      visit debate_path(debate)
Severity: Major
Found in spec/features/admin/activity_spec.rb and 1 other location - About 4 hrs to fix
spec/features/admin/activity_spec.rb on lines 10..67

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

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

  context 'Search' do

    background do
      user  = create(:user, username: 'Elizabeth Bathory', email: 'elizabeth@bathory.com')
      user2 = create(:user, username: 'Ada Lovelace', email: 'ada@lovelace.com')
Severity: Major
Found in spec/features/admin/moderators_spec.rb and 3 other locations - About 4 hrs to fix
spec/features/admin/administrators_spec.rb on lines 45..89
spec/features/admin/managers_spec.rb on lines 37..81
spec/features/admin/valuators_spec.rb on lines 58..102

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

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

  describe "phase" do
    it "is validated" do
      Budget::Phase::PHASE_KINDS.each do |phase|
        budget.phase = phase
        expect(budget).to be_valid
Severity: Major
Found in spec/custom/models/budget_spec.rb and 1 other location - About 4 hrs to fix
spec/models/budget_spec.rb on lines 51..117

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

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 "Proposals" do
    scenario "Shows moderation activity on proposals", :js do
      proposal = create(:proposal)

      visit proposal_path(proposal)
Severity: Major
Found in spec/features/admin/activity_spec.rb and 1 other location - About 4 hrs to fix
spec/features/admin/activity_spec.rb on lines 72..129

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

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

File polls_spec.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

feature 'Polls' do

  context "Concerns" do
Severity: Minor
Found in spec/features/polls/polls_spec.rb - About 4 hrs to fix

    File votes_spec.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rails_helper'
    
    feature 'Votes' do
    
      background do
    Severity: Minor
    Found in spec/features/votes_spec.rb - About 4 hrs to fix

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

        describe '#humanize_document_type' do
          xit "returns a humanized document type" do
            expect(humanize_document_type("1")).to eq "DNI"
            expect(humanize_document_type("2")).to eq "Passport"
            expect(humanize_document_type("3")).to eq "Residence card"
      Severity: Major
      Found in spec/helpers/users_helper_spec.rb and 1 other location - About 4 hrs to fix
      spec/custom/helpers/users_helper_spec.rb on lines 7..57

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

      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

        describe '#humanize_document_type' do
          xit "returns a humanized document type" do
            expect(humanize_document_type("1")).to eq "DNI"
            expect(humanize_document_type("2")).to eq "Passport"
            expect(humanize_document_type("3")).to eq "Residence card"
      Severity: Major
      Found in spec/custom/helpers/users_helper_spec.rb and 1 other location - About 4 hrs to fix
      spec/helpers/users_helper_spec.rb on lines 7..57

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

      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

      describe Verification::Letter do
      
        let(:user) { create(:user) }
      
        describe "validations" do
      Severity: Major
      Found in spec/custom/models/verification/letter_spec.rb and 1 other location - About 4 hrs to fix
      spec/models/verification/letter_spec.rb on lines 3..58

      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

      Further Reading

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

      describe Verification::Letter do
      
        let(:user) { create(:user) }
      
        describe "validations" do
      Severity: Major
      Found in spec/models/verification/letter_spec.rb and 1 other location - About 4 hrs to fix
      spec/custom/models/verification/letter_spec.rb on lines 3..58

      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

      Further Reading

      Class Budget has 32 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Budget < ActiveRecord::Base
      
        include Measurable
        include Sluggable
      
      
      Severity: Minor
      Found in app/models/budget.rb - About 4 hrs to fix

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

        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

        Class Proposal has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Proposal < ActiveRecord::Base
          include Rails.application.routes.url_helpers
          include Flaggable
          include Taggable
          include Conflictable
        Severity: Minor
        Found in app/models/proposal.rb - About 3 hrs to fix

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

            xscenario 'Creation date works differently in roots and in child comments, even when sorting by confidence_score' do
              old_root = create(:comment, commentable: legislation_annotation, created_at: Time.current - 10)
              new_root = create(:comment, commentable: legislation_annotation, created_at: Time.current)
              old_child = create(:comment, commentable: legislation_annotation, parent_id: new_root.id, created_at: Time.current - 10)
              new_child = create(:comment, commentable: legislation_annotation, parent_id: new_root.id, created_at: Time.current)
          Severity: Major
          Found in spec/features/comments/legislation_annotations_spec.rb and 1 other location - About 3 hrs to fix
          spec/custom/features/comments/legislation_annotations_spec.rb on lines 9..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 125.

          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

            xscenario 'Creation date works differently in roots and in child comments, even when sorting by confidence_score' do
              old_root = create(:comment, commentable: legislation_annotation, created_at: Time.current - 10)
              new_root = create(:comment, commentable: legislation_annotation, created_at: Time.current)
              old_child = create(:comment, commentable: legislation_annotation, parent_id: new_root.id, created_at: Time.current - 10)
              new_child = create(:comment, commentable: legislation_annotation, parent_id: new_root.id, created_at: Time.current)
          spec/features/comments/legislation_annotations_spec.rb on lines 108..136

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

          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

          File polls_spec.rb has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'rails_helper'
          
          feature 'Admin polls' do
          
            background do
          Severity: Minor
          Found in spec/features/admin/poll/polls_spec.rb - About 3 hrs to fix

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

                  if user.level_two_or_three_verified?
                    can :vote, Proposal
                    can :vote_featured, Proposal
                    can :vote, SpendingProposal
                    can :create, SpendingProposal
            Severity: Major
            Found in app/models/abilities/common.rb and 1 other location - About 3 hrs to fix
            app/models/custom/abilities/common.rb on lines 69..93

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

            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

                  if user.level_two_or_three_verified?
                    can :vote, Proposal
                    can :vote_featured, Proposal
                    can :vote, SpendingProposal
                    can :create, SpendingProposal
            Severity: Major
            Found in app/models/custom/abilities/common.rb and 1 other location - About 3 hrs to fix
            app/models/abilities/common.rb on lines 65..89

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

            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

            Class Stats has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Stats
            
                def initialize(poll)
                  @poll = poll
                end
            Severity: Minor
            Found in app/models/poll/stats.rb - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language