pasosdeJesus/msip

View on GitHub

Showing 214 of 272 total issues

Method importa_gen has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def importa_gen(datosent, datossal, menserror, opciones = {})
        datosent.keys.each do |ll|
          case ll.to_sym
          when :actualizado_en
            self.updated_at = datosent[ll.to_sym]
Severity: Minor
Found in app/models/msip/modelo.rb - About 1 hr to fix

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

          def campofecha_mesanio(*fields)
            fields.each do |f|
              define_method("#{f}_anio") do
                val = self[f]
                val&.year ? val.year : nil
    Severity: Minor
    Found in app/models/msip/localizacion.rb - About 1 hr to fix

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

                def index
                  if !params[:term]
                    respond_to do |format|
                      format.html { render(inline: "Falta variable term") }
                      format.json { render(inline: "Falta variable term") }
      Severity: Minor
      Found in lib/msip/concerns/controllers/gruposper_controller.rb - About 1 hr to fix

        Method opciones_tabla_basica has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def opciones_tabla_basica(clase, f, campo)
              col1 = clase.all
              if col1.respond_to?(:habilitados)
                col1 = col1.habilitados
              end
        Severity: Minor
        Found in app/helpers/msip/modelo_helper.rb - About 1 hr to fix

          Method genera_asociacion has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def genera_asociacion
                puts "Para asociarla en #{options.asocia}:"
                puts <<~EOF
                  Cree migracion que incluya
                    add_column :#{options.asocia}, :#{nom_arch}_id, :integer
          Severity: Minor
          Found in lib/generators/msip/tablabasica_generator.rb - About 1 hr to fix

            Method tema_usuario has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def tema_usuario(current_usuario)
                  t = if !current_usuario || !current_usuario.tema_id
                    if Msip::Tema.where(id: 1).count == 1
                      Msip::Tema.find(1)
                    else
            Severity: Minor
            Found in app/helpers/msip/temas_helper.rb - About 1 hr to fix

              Method msip_presenta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                        def msip_presenta(atr)
                          case atr.to_s
                          when "centro_poblado"
                            centropoblado ? centropoblado.nombre : ""
                          when "nacionalde"
              Severity: Minor
              Found in lib/msip/concerns/models/persona.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 edad_de_fechanac_fecha has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def edad_de_fechanac_fecha(anionac, mesnac, dianac,
                    anio, mes, dia)
                    if anionac.nil? || anionac == ""
                      return -1
                    end
              Severity: Minor
              Found in app/helpers/msip/edad_sexo_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 buscar_o_agregar has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                        def buscar_o_agregar(pais_id, departamento_id, municipio_id,
                          centropoblado_id, lugar, sitio, tsitio_id,
                          latitud, longitud,
                          usa_latlon = true)
              Severity: Major
              Found in lib/msip/concerns/models/ubicacionpre.rb - About 1 hr to fix

                Method despliega_abajo_dk has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def despliega_abajo_dk(opcionmenu, url, opciones = {}, &bloque)
                      copiaop = opciones
                      opab = opcionmenu.gsub(" ", "_")
                      maticon = "home"
                      if opciones[:maticon]
                Severity: Minor
                Found in app/helpers/msip/bootstrap_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 asegura_varambiente_bd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def asegura_varambiente_bd
                      # Toma ideas de https://github.com/opdemand/puppet-modules/blob/master/rails/files/databases.rake
                      abcs = ActiveRecord::Base.configurations
                      confbd = abcs.configurations.select { |c| c.env_name == Rails.env }.first
                
                
                Severity: Minor
                Found in app/helpers/msip/tareasrake_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 datos has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                          def datos
                            return unless params[:persona_id]
                
                            @persona = Msip::Persona.find(params[:persona_id].to_i)
                            authorize!(:read, @persona)
                Severity: Minor
                Found in lib/msip/concerns/controllers/personas_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 caja_de_verificacion_bs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def caja_de_verificacion_bs(idit, clase_div, valor, at_nombre,
                      etiqueta, opciones = {})
                      content_tag(
                        :div,
                        class: "form-check", # optional #{clase_div}"
                Severity: Minor
                Found in app/helpers/msip/bootstrap_helper.rb - About 1 hr to fix

                  Method separa_apellidos_nombres has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def separa_apellidos_nombres(nombre, menserror)
                        apellidos = "N"
                        nombres = "N"
                        n = nombre.to_s.gsub(/  */, " ").gsub(/^ /, "").gsub(/ $/, "")
                        p = n.split(" ")
                  Severity: Minor
                  Found in app/helpers/msip/importa_helper.rb - About 1 hr to fix

                    Method dif_meses_dias has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def dif_meses_dias(fechaini, fechafin)
                          m = 0
                          d = 0
                          if fechaini && fechafin && fechaini < fechafin
                            if fechafin.month < fechaini.month
                    Severity: Minor
                    Found in app/helpers/msip/formato_fecha_helper.rb - About 1 hr to fix

                      Method lista_params_msip has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def lista_params_msip
                                  r = [
                                    :id,
                                    :nusuario,
                                    :password,
                      Severity: Minor
                      Found in lib/msip/concerns/controllers/usuarios_controller.rb - About 1 hr to fix

                        Method lista_params_msip has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def lista_params_msip
                                    atributos_form + [
                                      :pais_id,
                                      :departamento_id,
                                      :municipio_id,
                        Severity: Minor
                        Found in lib/msip/concerns/controllers/personas_controller.rb - About 1 hr to fix

                          Method datos has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def datos
                                      return unless params[:persona_id]
                          
                                      @persona = Msip::Persona.find(params[:persona_id].to_i)
                                      authorize!(:read, @persona)
                          Severity: Minor
                          Found in lib/msip/concerns/controllers/personas_controller.rb - About 1 hr to fix

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

                                  def self.asociacion_combinada(atr)
                                    r = nil
                                    if atr.is_a?(Hash) &&
                                        (atr.first[0].to_s.ends_with?("_ids") ||
                                         atr.first[0].to_s.ends_with?("_attributes"))
                            Severity: Minor
                            Found in app/models/msip/modelo.rb - About 1 hr to fix

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

                                        def mostrar_portada
                                          if !params[:id].nil?
                                            @anexo = Anexo.find(params[:id].to_i)
                                            ruta = @anexo.adjunto_file_name
                                            # ls = %x(ls -l #{Msip.ruta_anexos})
                              Severity: Minor
                              Found in lib/msip/concerns/controllers/anexos_controller.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language