AyuntamientoMadrid/participacion

View on GitHub

Showing 1,085 of 1,085 total issues

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

    scenario "Shows moderation activity from moderation screen" do
      proposal1 = create(:proposal)
      proposal2 = create(:proposal)
      proposal3 = create(:proposal)

Severity: Major
Found in spec/system/admin/activity_spec.rb and 1 other location - About 1 hr to fix
spec/system/admin/activity_spec.rb on lines 98..121

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

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 "main_link_url" do
    it "is not required if main_link_text is not provided" do
      valid_budget = build(:budget, main_link_text: nil)

      expect(valid_budget).to be_valid
Severity: Major
Found in spec/models/budget_spec.rb and 1 other location - About 1 hr to fix
spec/models/budget/phase_spec.rb on lines 125..144

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

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 "Shows moderation activity from moderation screen" do
      debate1 = create(:debate)
      debate2 = create(:debate)
      debate3 = create(:debate)

Severity: Major
Found in spec/system/admin/activity_spec.rb and 1 other location - About 1 hr to fix
spec/system/admin/activity_spec.rb on lines 31..54

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

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 "Last year" do
        bdgt_invest1 = create(:budget_investment, heading: heading, created_at: 300.days.ago)
        bdgt_invest2 = create(:budget_investment, heading: heading, created_at: 350.days.ago)
        bdgt_invest3 = create(:budget_investment, heading: heading, created_at: 370.days.ago)

Severity: Major
Found in spec/system/advanced_search_spec.rb and 1 other location - About 1 hr to fix
spec/system/advanced_search_spec.rb on lines 69..85

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

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

Function initializeDirectUploadInput has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initializeDirectUploadInput: function(input) {
      var inputData;
      inputData = this.buildData([], input);
      $(input).fileupload({
        paramName: "attachment",
Severity: Minor
Found in app/assets/javascripts/documentable.js - About 1 hr to fix

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

        it "returns the amount of votes left for approval voting" do
          budget = create(:budget, :approval)
          heading1 = create(:budget_heading, budget: budget, max_ballot_lines: 2)
          heading2 = create(:budget_heading, budget: budget, max_ballot_lines: 3)
          ballot = create(:budget_ballot, budget: budget)
    Severity: Major
    Found in spec/models/budget/ballot_spec.rb and 1 other location - About 1 hr to fix
    spec/models/budget/ballot_spec.rb on lines 69..80

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

    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

        it "returns the votes cast on a specific heading for approval voting" do
          budget = create(:budget, :approval)
          heading1 = create(:budget_heading, budget: budget, max_ballot_lines: 2)
          heading2 = create(:budget_heading, budget: budget, max_ballot_lines: 3)
          ballot = create(:budget_ballot, budget: budget)
    Severity: Major
    Found in spec/models/budget/ballot_spec.rb and 1 other location - About 1 hr to fix
    spec/models/budget/ballot_spec.rb on lines 109..120

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

    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

    Function initializeDirectUploadInput has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initializeDirectUploadInput: function(input) {
          var inputData;
          inputData = this.buildData([], input);
          $(input).fileupload({
            paramName: "attachment",
    Severity: Minor
    Found in app/assets/javascripts/imageable.js - About 1 hr to fix

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

        describe "#proposals" do
          it "can assign proposals to a model" do
            related_sdg.proposals = [proposal, another_proposal]
      
            expect(SDG::Relation.count).to be 2
      Severity: Major
      Found in spec/models/sdg/related_spec.rb and 3 other locations - About 1 hr to fix
      spec/models/sdg/relatable_spec.rb on lines 13..27
      spec/models/sdg/relatable_spec.rb on lines 39..53
      spec/models/sdg/relatable_spec.rb on lines 84..98

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

      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

        describe "#sdg_goals" do
          it "can assign goals to a model" do
            relatable.sdg_goals = [goal, another_goal]
      
            expect(SDG::Relation.count).to be 2
      Severity: Major
      Found in spec/models/sdg/relatable_spec.rb and 3 other locations - About 1 hr to fix
      spec/models/sdg/relatable_spec.rb on lines 39..53
      spec/models/sdg/relatable_spec.rb on lines 84..98
      spec/models/sdg/related_spec.rb on lines 8..22

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

      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

        describe "#sdg_global_targets" do
          it "can assign targets to a model" do
            relatable.sdg_global_targets = [target, another_target]
      
            expect(SDG::Relation.count).to be 2
      Severity: Major
      Found in spec/models/sdg/relatable_spec.rb and 3 other locations - About 1 hr to fix
      spec/models/sdg/relatable_spec.rb on lines 13..27
      spec/models/sdg/relatable_spec.rb on lines 84..98
      spec/models/sdg/related_spec.rb on lines 8..22

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

      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

        describe "#sdg_local_targets" do
          it "can assign local targets to a model" do
            relatable.sdg_local_targets = [local_target, another_local_target]
      
            expect(SDG::Relation.count).to be 2
      Severity: Major
      Found in spec/models/sdg/relatable_spec.rb and 3 other locations - About 1 hr to fix
      spec/models/sdg/relatable_spec.rb on lines 13..27
      spec/models/sdg/relatable_spec.rb on lines 39..53
      spec/models/sdg/related_spec.rb on lines 8..22

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

      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

      Method initialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(user)
            merge Abilities::Common.new(user)
      
            can :read, Organization
            can(:verify, Organization) { |o| !o.verified? }
      Severity: Minor
      Found in app/models/abilities/moderation.rb - About 1 hr to fix

        Method run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run
            begin
              export_proposals_to_json
              export_budget_investments_to_json
              export_comments_to_json
        Severity: Minor
        Found in app/models/machine_learning.rb - About 1 hr to fix

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

              in_browser(:two) do
                expect(page).to have_content("Here you can validate user documents and store voting results")
          
                visit new_officing_residence_path
                expect(page).to have_css "#residence_document_type"
          Severity: Major
          Found in spec/system/officing_spec.rb and 1 other location - About 1 hr to fix
          spec/system/officing_spec.rb on lines 127..147

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

          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

              in_browser(:one) do
                expect(page).to have_content("Here you can validate user documents and store voting results")
          
                visit new_officing_residence_path
                expect(page).to have_css "#residence_document_type"
          Severity: Major
          Found in spec/system/officing_spec.rb and 1 other location - About 1 hr to fix
          spec/system/officing_spec.rb on lines 150..170

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

          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

              it "validates that the answers are included in the Poll::Question's list" do
                question = create(:poll_question)
                create(:poll_question_option, title: "One", question: question)
                create(:poll_question_option, title: "Two", question: question)
                create(:poll_question_option, title: "Three", question: question)
          Severity: Major
          Found in spec/models/poll/partial_result_spec.rb and 1 other location - About 1 hr to fix
          spec/models/poll/answer_spec.rb on lines 92..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 68.

          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

              it "is valid for answers included in the Poll::Question's question_options list" do
                question = create(:poll_question)
                create(:poll_question_option, title: "One", question: question)
                create(:poll_question_option, title: "Two", question: question)
                create(:poll_question_option, title: "Three", question: question)
          Severity: Major
          Found in spec/models/poll/answer_spec.rb and 1 other location - About 1 hr to fix
          spec/models/poll/partial_result_spec.rb on lines 5..15

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

          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

          Function initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              initialize: function() {
                $(".markdown-editor").each(function() {
                  var editor, md;
                  md = window.markdownit({
                    html: true,
          Severity: Minor
          Found in app/assets/javascripts/markdown_editor.js - About 1 hr to fix

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

                scenario "shows proposals list" do
                  visit summary_legislation_process_path(process)
            
                  expect(page).to have_content "Debate phase"
                  expect(page).to have_content "No debates"
            Severity: Major
            Found in spec/system/legislation/summary_spec.rb and 1 other location - About 1 hr to fix
            spec/system/legislation/summary_spec.rb on lines 152..168

            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

            Severity
            Category
            Status
            Source
            Language