AyuntamientoMadrid/participacion

View on GitHub

Showing 1,085 of 1,085 total issues

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

  describe "the current order" do
    it "defaults to the first one on the list" do
      get :index
      expect(response.body).to eq("created_at (created_at votes_count flags_count)")
    end
Severity: Major
Found in spec/controllers/concerns/has_orders_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/concerns/has_filters_spec.rb on lines 18..31

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

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 "processes disabled" do
    before do
      Setting["process.budgets"] = false
      Setting["process.debates"] = false
      Setting["process.legislation"] = false
Severity: Major
Found in spec/components/sdg_management/menu_component_spec.rb and 1 other location - About 1 hr to fix
spec/components/sdg_management/menu_component_spec.rb on lines 48..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 50.

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 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initialize: function() {
      var anchor, elem, ul;
      elem = $("[data-tree-navigator]");
      if (elem.length === 0) {
        return;
Severity: Minor
Found in app/assets/javascripts/tree_navigator.js - About 1 hr to fix

    Method included has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.included(base)
        base.extend(ClassMethods)
        class_eval do
          def hide
            return false if hidden?
    Severity: Minor
    Found in app/lib/acts_as_paranoid_aliases.rb - About 1 hr to fix

      Method basic_translations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.basic_translations
          %w[
            debates.index.section_footer.title
            debates.index.section_footer.description
            debates.index.section_footer.help_text_1
      Severity: Minor
      Found in app/models/i18n_content.rb - About 1 hr to fix

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

            context "final version publication phase" do
              scenario "not open", :with_frozen_time do
                process = create(:legislation_process, result_publication_date: Date.current + 1.day)
        
                visit result_publication_legislation_process_path(process)
        Severity: Major
        Found in spec/system/legislation/processes_spec.rb and 1 other location - About 1 hr to fix
        spec/system/legislation/processes_spec.rb on lines 317..335

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

        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 "orders by weight and then votes" do
                title_some_votes    = create(:debate, title: "stop corruption", cached_votes_up: 5)
                title_least_voted   = create(:debate, title: "stop corruption", cached_votes_up: 2)
                title_most_voted    = create(:debate, title: "stop corruption", cached_votes_up: 10)
                description_most_voted = create(:debate, description: "stop corruption", cached_votes_up: 10)
        Severity: Major
        Found in spec/models/debate_spec.rb and 1 other location - About 1 hr to fix
        spec/models/proposal_spec.rb on lines 614..623

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

        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 debates related to the user's interests ordered by cached_votes_total" do
              create(:proposal, tag_list: "Sport", followers: [user])
        
              debate1 =  create(:debate, cached_votes_total: 1, tag_list: "Sport")
              debate2 =  create(:debate, cached_votes_total: 5, tag_list: "Sport")
        Severity: Major
        Found in spec/models/debate_spec.rb and 1 other location - About 1 hr to fix
        spec/models/proposal_spec.rb on lines 938..947

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

        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 "orders by weight and then by votes" do
                title_some_votes   = create(:proposal, title: "stop corruption", cached_votes_up: 5)
                title_least_voted  = create(:proposal, title: "stop corruption", cached_votes_up: 2)
                title_most_voted   = create(:proposal, title: "stop corruption", cached_votes_up: 10)
        
        
        Severity: Major
        Found in spec/models/proposal_spec.rb and 1 other location - About 1 hr to fix
        spec/models/debate_spec.rb on lines 582..590

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

        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 "Send email on topic comment" do
              comment_on(topic)
        
              email = open_last_email
              expect(email).to have_subject("Someone has commented on your topic")
        Severity: Major
        Found in spec/system/emails_spec.rb and 1 other location - About 1 hr to fix
        spec/system/emails_spec.rb on lines 102..111

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

        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

          scenario "Create" do
            user = create(:user)
            login_as(user)
        
            visit new_debate_path
        Severity: Major
        Found in spec/system/tags_spec.rb and 1 other location - About 1 hr to fix
        spec/system/tags/debates_spec.rb on lines 63..79

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

        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

          scenario "Create" do
            user = create(:user)
            login_as(user)
        
            visit new_debate_path
        Severity: Major
        Found in spec/system/tags/debates_spec.rb and 1 other location - About 1 hr to fix
        spec/system/tags_spec.rb on lines 56..72

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

        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 "Send email on budget investment comment" do
              comment_on(investment)
        
              email = open_last_email
              expect(email).to have_subject("Someone has commented on your investment")
        Severity: Major
        Found in spec/system/emails_spec.rb and 1 other location - About 1 hr to fix
        spec/system/emails_spec.rb on lines 131..140

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

        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 "draft publication phase" do
              scenario "not open", :with_frozen_time do
                process = create(:legislation_process, draft_publication_date: Date.current + 1.day)
        
                visit draft_publication_legislation_process_path(process)
        Severity: Major
        Found in spec/system/legislation/processes_spec.rb and 1 other location - About 1 hr to fix
        spec/system/legislation/processes_spec.rb on lines 361..379

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

        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 proposals related to the user's interests ordered by cached_votes_up" do
              create(:proposal, tag_list: "Sport", followers: [user])
        
              proposal1 = create(:proposal, cached_votes_up: 1,  tag_list: "Sport")
              proposal2 = create(:proposal, cached_votes_up: 5,  tag_list: "Sport")
        Severity: Major
        Found in spec/models/proposal_spec.rb and 1 other location - About 1 hr to fix
        spec/models/debate_spec.rb on lines 743..752

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

        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 create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
            if !@process.allegations_phase.open? || @draft_version.final_version?
              render(json: {}, status: :not_found) && return
            end
        
        
        Severity: Minor
        Found in app/controllers/legislation/annotations_controller.rb - About 1 hr to fix

          Method import_ml_proposals_tags has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def import_ml_proposals_tags
                ids = {}
                json_file = data_folder.join(MachineLearning.proposals_tags_filename)
                json_data = JSON.parse(File.read(json_file)).each(&:deep_symbolize_keys!)
                json_data.each do |attributes|
          Severity: Minor
          Found in app/models/machine_learning.rb - About 1 hr to fix

            Method settings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def settings
                %w[
                  feature.featured_proposals
                  feature.facebook_login
                  feature.google_login
            Severity: Minor
            Found in app/components/admin/settings/features_tab_component.rb - About 1 hr to fix

              Method data_output_files has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def data_output_files
                    files = { tags: [], related_content: [], comments_summary: [] }
              
                    if File.exist?(data_folder.join(proposals_tags_filename))
                      files[:tags] << proposals_tags_filename
              Severity: Minor
              Found in app/models/machine_learning.rb - About 1 hr to fix

                Method import_ml_investments_tags has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def import_ml_investments_tags
                      ids = {}
                      json_file = data_folder.join(MachineLearning.investments_tags_filename)
                      json_data = JSON.parse(File.read(json_file)).each(&:deep_symbolize_keys!)
                      json_data.each do |attributes|
                Severity: Minor
                Found in app/models/machine_learning.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language