AyuntamientoMadrid/participacion

View on GitHub

Showing 2,528 of 2,528 total issues

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

  describe "#cleanup_investments_tags!" do
    it "does not delete other machine learning generated data" do
      create(:ml_summary_comment, commentable: create(:proposal))
      create(:ml_summary_comment, commentable: create(:budget_investment))

Severity: Major
Found in spec/models/machine_learning_spec.rb and 1 other location - About 7 hrs to fix
spec/models/machine_learning_spec.rb on lines 10..62

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

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 menu_component.rb has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Admin::MenuComponent < ApplicationComponent
  include LinkListHelper
  use_helpers :can?

  def links
Severity: Minor
Found in app/components/admin/menu_component.rb - About 7 hrs to fix

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

        context "reorder" do
          it "is able to reorder by hot_score after searching" do
            lowest_score  = create(:proposal,  title: "stop corruption", cached_votes_up: 1)
            highest_score = create(:proposal,  title: "stop corruption", cached_votes_up: 2)
            average_score = create(:proposal,  title: "stop corruption", cached_votes_up: 3)
    Severity: Major
    Found in spec/models/proposal_spec.rb and 1 other location - About 7 hrs to fix
    spec/models/debate_spec.rb on lines 603..665

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

    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 "reorder" do
          it "is able to reorder by hot_score after searching" do
            lowest_score  = create(:debate,  title: "stop corruption", cached_votes_up: 1)
            highest_score = create(:debate,  title: "stop corruption", cached_votes_up: 2)
            average_score = create(:debate,  title: "stop corruption", cached_votes_up: 3)
    Severity: Major
    Found in spec/models/debate_spec.rb and 1 other location - About 7 hrs to fix
    spec/models/proposal_spec.rb on lines 637..699

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

    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 machine_learning_spec.rb has 481 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "rails_helper"
    
    describe MachineLearning do
      def full_sanitizer(string)
        ActionView::Base.full_sanitizer.sanitize(string)
    Severity: Minor
    Found in spec/models/machine_learning_spec.rb - About 7 hrs to fix

      File graphql_spec.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "rails_helper"
      
      def execute(query_string, context = {}, variables = {})
        ConsulSchema.execute(query_string, context: context, variables: variables)
      end
      Severity: Minor
      Found in spec/lib/graphql_spec.rb - About 7 hrs to fix

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

          describe "save latitude" do
            it "Doesn't allow latitude < -90" do
              heading = create(:budget_heading, group: group, name: "Latitude is < -90")
        
              heading.latitude = "-90.127491"
        Severity: Major
        Found in spec/models/budget/heading_spec.rb and 1 other location - About 7 hrs to fix
        spec/models/budget/heading_spec.rb on lines 169..262

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

        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

          describe "save longitude" do
            it "Doesn't allow longitude < -180" do
              heading = create(:budget_heading, group: group, name: "Longitude is < -180")
        
              heading.longitude = "-180.127491"
        Severity: Major
        Found in spec/models/budget/heading_spec.rb and 1 other location - About 7 hrs to fix
        spec/models/budget/heading_spec.rb on lines 73..165

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

        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 Investment has 51 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Investment < ApplicationRecord
            SORTING_OPTIONS = { id: "id", supports: "cached_votes_up" }.freeze
        
            include Measurable
            include Sanitizable
        Severity: Major
        Found in app/models/budget/investment.rb - About 7 hrs to fix

          File poll_spec.rb has 460 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rails_helper"
          
          describe Poll do
            let(:poll) { build(:poll, :future) }
          
          
          Severity: Minor
          Found in spec/models/poll/poll_spec.rb - About 7 hrs to fix

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

              context "Search" do
                let(:user)      { create(:user, username: "Taylor Swift", email: "taylor@swift.com") }
                let(:user2)     { create(:user, username: "Stephanie Corneliussen", email: "steph@mrrobot.com") }
                let!(:manager1) { create(:manager, user: user) }
                let!(:manager2) { create(:manager, user: user2) }
            Severity: Major
            Found in spec/system/admin/managers_spec.rb and 1 other location - About 6 hrs to fix
            spec/system/admin/moderators_spec.rb on lines 42..100

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

            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 "Search" do
                let(:user)        { create(:user, username: "Elizabeth Bathory", email: "elizabeth@bathory.com") }
                let(:user2)       { create(:user, username: "Ada Lovelace", email: "ada@lovelace.com") }
                let!(:moderator1) { create(:moderator, user: user) }
                let!(:moderator2) { create(:moderator, user: user2) }
            Severity: Major
            Found in spec/system/admin/moderators_spec.rb and 1 other location - About 6 hrs to fix
            spec/system/admin/managers_spec.rb on lines 42..100

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

            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 budget_spec.rb has 434 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "rails_helper"
            
            describe Budget do
              let(:budget) { create(:budget) }
            
            
            Severity: Minor
            Found in spec/models/budget_spec.rb - About 6 hrs to fix

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

              require "rails_helper"
              
              describe "Admin polls", :admin do
                scenario "Index empty" do
                  visit admin_root_path
              Severity: Minor
              Found in spec/system/admin/poll/polls_spec.rb - About 6 hrs to fix

                Class MachineLearning has 45 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class MachineLearning
                  attr_reader :user, :script, :previous_modified_date
                  attr_accessor :job
                
                  SCRIPTS_FOLDER = Rails.root.join("public", "machine_learning", "scripts").freeze
                Severity: Minor
                Found in app/models/machine_learning.rb - About 6 hrs to fix

                  File budget_investments_spec.rb has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require "rails_helper"
                  
                  describe "Budget Investments" do
                    let(:manager) { create(:manager) }
                    let(:budget)  { create(:budget, :selecting, name: "2033", slug: "budget_slug") }
                  Severity: Minor
                  Found in spec/system/management/budget_investments_spec.rb - About 6 hrs to fix

                    File machine_learning.rb has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class MachineLearning
                      attr_reader :user, :script, :previous_modified_date
                      attr_accessor :job
                    
                      SCRIPTS_FOLDER = Rails.root.join("public", "machine_learning", "scripts").freeze
                    Severity: Minor
                    Found in app/models/machine_learning.rb - About 5 hrs to fix

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

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

                        File emails_spec.rb has 410 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require "rails_helper"
                        
                        describe "Emails" do
                          before do
                            reset_mailer
                        Severity: Minor
                        Found in spec/system/emails_spec.rb - About 5 hrs to fix

                          File budget_investments_spec.rb has 408 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require "rails_helper"
                          
                          describe "Valuation budget investments" do
                            let(:budget) { create(:budget, :valuating) }
                            let(:valuator) do
                          Severity: Minor
                          Found in spec/system/valuation/budget_investments_spec.rb - About 5 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language