AyuntamientoMadrid/participacion

View on GitHub

Showing 143 of 1,085 total issues

Function onClick has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onClick: function(event) {
      var annotation_id, annotation_url, parents, parents_ids, target;
      event.preventDefault();
      event.stopPropagation();
      if (App.LegislationAnnotatable.isMobile()) {
Severity: Minor
Found in app/assets/javascripts/legislation_annotatable.js - About 1 hr to fix

    Function customShow has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        customShow: function(position) {
          var annotation_url;
          $(this.element).html("");
          // Clean comments section and open it
          $("#comments-box").html("");
    Severity: Minor
    Found in app/assets/javascripts/legislation_annotatable.js - About 1 hr to fix

      Method import_ml_proposals_tags has a Cognitive Complexity of 11 (exceeds 5 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

      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 run has a Cognitive Complexity of 11 (exceeds 5 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

      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 create has a Cognitive Complexity of 11 (exceeds 5 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

      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 check_image has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_image
            return unless image.attached?
      
            unless image.analyzed?
              attachment_changes["image"].upload
      Severity: Minor
      Found in app/models/site_customization/image.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 import_ml_investments_tags has a Cognitive Complexity of 11 (exceeds 5 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

      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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          self.resource = resource_class.find_by(confirmation_token: params[:confirmation_token])
      
          if resource.encrypted_password.blank?
            resource.assign_attributes(resource_params)
      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 admin_links has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def admin_links
            [
              (admin_link if user.administrator?),
              (moderation_link if user.administrator? || user.moderator?),
              (valuation_link if feature?(:budgets) && (user.administrator? || user.valuator?)),
      Severity: Minor
      Found in app/components/layout/admin_login_items_component.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

      Function init_autocomplete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init_autocomplete: function() {
            $(".tag-autocomplete").autocomplete({
              source: function(request, response) {
                $.ajax({
                  url: $(".tag-autocomplete").data("js-url"),
      Severity: Minor
      Found in app/assets/javascripts/tag_autocomplete.js - About 1 hr to fix

        Method allowed_params has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def allowed_params
              [
                :start_date,
                :end_date,
                :debate_start_date,
        Severity: Minor
        Found in app/controllers/admin/legislation/processes_controller.rb - About 1 hr to fix

          Function scrollToAnchor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              scrollToAnchor: function() {
                return {
                  annotationsLoaded: function() {
                    var anchor, ann_id, checkExist;
                    anchor = $(location).attr("hash");
          Severity: Minor
          Found in app/assets/javascripts/legislation_annotatable.js - About 1 hr to fix

            Method update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.update(contents, enabled_translations = Setting.enabled_locales)
                contents.each do |content|
                  values = content[:values].slice(*translation_params(enabled_translations))
            
                  unless values.empty?
            Severity: Minor
            Found in app/models/i18n_content.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 disabled_commentables has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def disabled_commentables
                  [
                    ("Debate" unless feature?(:debates)),
                    ("Budget::Investment" unless feature?(:budgets)),
                    (["Legislation::Question",
            Severity: Minor
            Found in app/components/users/public_activity_component.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 validate_image_dimensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def validate_image_dimensions
                  if accepted_content_types.include?(attachment_content_type)
                    return true if imageable_class == Widget::Card
            
                    unless attachment.analyzed?
            Severity: Minor
            Found in app/models/image.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def initialize(user)
                if user # logged-in users
                  merge Abilities::Valuator.new(user) if user.valuator?
            
                  if user.administrator?
            Severity: Minor
            Found in app/models/ability.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 list_items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def list_items
                  present_links.map do |text, url, current_or_options = false, options = {}|
                    if current_or_options.is_a?(Hash)
                      current = false
                      link_options = current_or_options
            Severity: Minor
            Found in app/components/shared/link_list_component.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 advanced_filters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.advanced_filters(params, results)
                  results = results.without_admin      if params[:advanced_filters].include?("without_admin")
                  results = results.without_valuator   if params[:advanced_filters].include?("without_valuator")
                  results = results.under_valuation    if params[:advanced_filters].include?("under_valuation")
                  results = results.valuation_finished if params[:advanced_filters].include?("valuation_finished")
            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

            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
                Severity
                Category
                Status
                Source
                Language