AyuntamientoMadrid/participacion

View on GitHub

Showing 2,535 of 2,535 total issues

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

    it "does not delete other machine learning generated data" do
      proposal = create(:proposal)
      investment = create(:budget_investment)

      create(:ml_summary_comment, commentable: proposal)
Severity: Major
Found in spec/models/machine_learning_spec.rb and 1 other location - About 3 hrs to fix
spec/models/machine_learning_spec.rb on lines 123..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 129.

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 "does not delete other machine learning generated data" do
      proposal = create(:proposal)
      investment = create(:budget_investment)

      create(:ml_summary_comment, commentable: proposal)
Severity: Major
Found in spec/models/machine_learning_spec.rb and 1 other location - About 3 hrs to fix
spec/models/machine_learning_spec.rb on lines 172..196

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

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

    def initialize(user)
      merge Abilities::Everyone.new(user)

      can [:read, :update], User, id: user.id

Severity: Major
Found in app/models/abilities/common.rb - About 3 hrs to fix

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

    (function() {
      "use strict";
      App.ModeratorBudgetInvestments = {
        add_class_faded: function(id) {
          $("#" + id).addClass("faded");
    Severity: Major
    Found in app/assets/javascripts/moderator_budget_investments.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/moderator_debates.js on lines 1..12
    app/assets/javascripts/moderator_legislation_proposals.js on lines 1..12
    app/assets/javascripts/moderator_proposals.js on lines 1..12

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

    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

    (function() {
      "use strict";
      App.ModeratorLegislationProposals = {
        add_class_faded: function(id) {
          $("#" + id).addClass("faded");
    Severity: Major
    Found in app/assets/javascripts/moderator_legislation_proposals.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/moderator_budget_investments.js on lines 1..12
    app/assets/javascripts/moderator_debates.js on lines 1..12
    app/assets/javascripts/moderator_proposals.js on lines 1..12

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

    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

    (function() {
      "use strict";
      App.ModeratorDebates = {
        add_class_faded: function(id) {
          $("#" + id).addClass("faded");
    Severity: Major
    Found in app/assets/javascripts/moderator_debates.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/moderator_budget_investments.js on lines 1..12
    app/assets/javascripts/moderator_legislation_proposals.js on lines 1..12
    app/assets/javascripts/moderator_proposals.js on lines 1..12

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

    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

    (function() {
      "use strict";
      App.ModeratorProposals = {
        add_class_faded: function(id) {
          $("#" + id).addClass("faded");
    Severity: Major
    Found in app/assets/javascripts/moderator_proposals.js and 3 other locations - About 3 hrs to fix
    app/assets/javascripts/moderator_budget_investments.js on lines 1..12
    app/assets/javascripts/moderator_debates.js on lines 1..12
    app/assets/javascripts/moderator_legislation_proposals.js on lines 1..12

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

    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

        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: Major
    Found in app/models/machine_learning.rb and 1 other location - About 3 hrs to fix
    app/models/machine_learning.rb on lines 373..398

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

    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

        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: Major
    Found in app/models/machine_learning.rb and 1 other location - About 3 hrs to fix
    app/models/machine_learning.rb on lines 403..428

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

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

    require "rails_helper"
    
    describe "Admin collaborative legislation", :admin do
      it_behaves_like "admin_milestoneable",
                      :legislation_process,
    Severity: Minor
    Found in spec/system/admin/legislation/processes_spec.rb - About 3 hrs to fix

      File proposal_notifications_spec.rb has 300 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "rails_helper"
      
      describe "Proposal Notifications" do
        scenario "Send a notification" do
          author = create(:user, :with_proposal)
      Severity: Minor
      Found in spec/system/proposal_notifications_spec.rb - About 3 hrs to fix

        File process_spec.rb has 298 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "rails_helper"
        
        describe Legislation::Process do
          let(:process) { create(:legislation_process) }
        
        
        Severity: Minor
        Found in spec/models/legislation/process_spec.rb - About 3 hrs to fix

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

              context "Ascending" do
                scenario "Sort by ID" do
                  visit admin_budget_budget_investments_path(budget, sort_by: "id", direction: "asc")
          
                  expect("B First Investment").to appear_before("A Second Investment")
          Severity: Major
          Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 3 hrs to fix
          spec/system/admin/budget_investments_spec.rb on lines 853..881

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

          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 "Descending" do
                scenario "Sort by ID" do
                  visit admin_budget_budget_investments_path(budget, sort_by: "id", direction: "desc")
          
                  expect("C Third Investment").to appear_before("A Second Investment")
          Severity: Major
          Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 3 hrs to fix
          spec/system/admin/budget_investments_spec.rb on lines 821..849

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

          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 "SDG processes disabled" do
              it "raises feature disabled for budgets" do
                Setting["sdg.process.budgets"] = false
          
                expect do
          Severity: Major
          Found in spec/controllers/sdg_management/relations_controller_spec.rb and 1 other location - About 3 hrs to fix
          spec/controllers/sdg_management/relations_controller_spec.rb on lines 15..53

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

          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
              it "raises feature disabled for budgets" do
                Setting["process.budgets"] = false
          
                expect do
          Severity: Major
          Found in spec/controllers/sdg_management/relations_controller_spec.rb and 1 other location - About 3 hrs to fix
          spec/controllers/sdg_management/relations_controller_spec.rb on lines 57..95

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

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

          require "rails_helper"
          require "cancan/matchers"
          
          describe Abilities::Common do
            subject(:ability) { Ability.new(user) }
          Severity: Minor
          Found in spec/models/abilities/common_spec.rb - About 3 hrs to fix

            Function editorConfig has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            CKEDITOR.editorConfig = function( config )
            {
            
              config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
              config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
            Severity: Major
            Found in app/assets/javascripts/ckeditor/config.js - About 2 hrs to fix

              File system_emails_spec.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "rails_helper"
              
              describe "System Emails" do
                let(:admin) { create(:administrator) }
              
              
              Severity: Minor
              Found in spec/system/admin/system_emails_spec.rb - About 2 hrs to fix

                File advanced_search_spec.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require "rails_helper"
                
                describe "Advanced search" do
                  let(:budget)  { create(:budget, name: "Big Budget") }
                  let(:heading) { create(:budget_heading, budget: budget, name: "More hospitals") }
                Severity: Minor
                Found in spec/system/advanced_search_spec.rb - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language