AyuntamientoMadrid/participacion

View on GitHub

Showing 143 of 1,085 total issues

File stats_spec.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rails_helper"

describe Budget::Stats do
  let(:budget) { create(:budget, :finished) }
  let(:stats) { Budget::Stats.new(budget) }
Severity: Minor
Found in spec/models/budget/stats_spec.rb - About 2 hrs to fix

    Class BudgetInvestmentsController has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Admin::BudgetInvestmentsController < Admin::BaseController
      include FeatureFlags
      include CommentableActions
      include Translatable
    
    
    Severity: Minor
    Found in app/controllers/admin/budget_investments_controller.rb - About 2 hrs to fix

      File dashboard_graphs.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      //= require d3
      //= require c3
      //= require c3ext
      
      (function() {
      Severity: Minor
      Found in app/assets/javascripts/dashboard_graphs.js - About 2 hrs to fix

        Function editorConfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

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

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function initialize_modules has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var initialize_modules = function() {
          "use strict";
        
          App.Options.initialize();
          App.Questions.initialize();
        Severity: Major
        Found in app/assets/javascripts/application.js - About 2 hrs to fix

          File setting_spec.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rails_helper"
          
          describe Setting do
            before do
              Setting["official_level_1_name"] = "Stormtrooper"
          Severity: Minor
          Found in spec/models/setting_spec.rb - About 2 hrs to fix

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

            require "rails_helper"
            
            describe "Tags" do
              let(:author)  { create(:user, :level_two, username: "Isabel") }
              let(:budget)  { create(:budget, name: "Big Budget") }
            Severity: Minor
            Found in spec/system/tags/budget_investments_spec.rb - About 2 hrs to fix

              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

                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

                  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

                      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

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

                            initialize: function() {
                              var current_user_id;
                              $("body").on("renderLegislationAnnotation", App.LegislationAnnotatable.renderAnnotationComments);
                              $("body").on("click", "[data-annotation-id]", App.LegislationAnnotatable.onClick);
                              $("body").on("click", "[data-cancel-annotation]", function(e) {
                        Severity: Minor
                        Found in app/assets/javascripts/legislation_annotatable.js - About 1 hr to fix

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

                              initialize: function() {
                                if ($(".sdg-related-list-selector").length) {
                                  var amsify_suggestags = new AmsifySuggestags($(".sdg-related-list-selector .input"));
                          
                                  amsify_suggestags.getItem = function(value) {
                          Severity: Minor
                          Found in app/assets/javascripts/sdg/related_list_selector.js - About 1 hr to fix

                            Method calculate_user_status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def calculate_user_status(authorable = nil)
                                user_status = "user"
                            
                                if user_signed_in?
                                  user_status += ":signed"
                            Severity: Minor
                            Found in app/helpers/cache_keys_helper.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method scoped_filter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def self.scoped_filter(params, current_filter)
                                  budget  = Budget.find_by_slug_or_id params[:budget_id]
                                  results = Investment.by_budget(budget)
                            
                                  if params[:min_total_supports].present?
                            Severity: Minor
                            Found in app/models/budget/investment.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method description_from has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def description_from(script_filename)
                                  description = ""
                                  delimiter = '"""'
                                  break_line = "<br>"
                                  comment_found = false
                            Severity: Minor
                            Found in app/models/machine_learning.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def show
                                # In the default implementation, this already confirms the resource:
                                # self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
                                self.resource = resource_class.find_by!(confirmation_token: params[:confirmation_token])
                            
                            
                            Severity: Minor
                            Found in app/controllers/users/confirmations_controller.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

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

                              def settings
                                %w[
                                  official_level_1_name
                                  official_level_2_name
                                  official_level_3_name
                            Severity: Minor
                            Found in app/components/admin/settings/configuration_tab_component.rb - About 1 hr to fix

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

                                  initialize: function() {
                                    $("[data-js-suggest-result]").each(function() {
                                      var $this, callback, timer;
                                      $this = $(this);
                                      callback = function() {
                              Severity: Minor
                              Found in app/assets/javascripts/suggest.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language