pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

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

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

          if (typeof elemento.tomselect != 'undefined') {
            elemento.tomselect.clear() 
            elemento.tomselect.clearOptions()
            elemento.tomselect.sync()
            elemento.tomselect.refreshOptions()
    Severity: Major
    Found in app/javascript/controllers/motor.js and 1 other location - About 1 hr to fix
    app/javascript/controllers/motor.js on lines 169..174

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

    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

        if (el.tomselect) {
          el.tomselect.clear()
          el.tomselect.clearOptions()
          el.tomselect.sync()
          el.tomselect.refreshOptions()
    Severity: Major
    Found in app/javascript/controllers/motor.js and 1 other location - About 1 hr to fix
    app/javascript/controllers/motor.js on lines 331..344

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

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

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

                              def atributos_index
                                [
                                  :id,
                                  :nombre,
                                  :fondo,
                    Severity: Minor
                    Found in lib/msip/concerns/controllers/temas_controller.rb - About 1 hr to fix

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

                          def fin_semestre_ant
                            hoy = Time.zone.today
                            anio = hoy.year
                            if hoy.mon >= 7 && hoy.mon < 12
                              fin = anio.to_s + "-" + "06-30"
                      Severity: Major
                      Found in app/helpers/msip/formato_fecha_helper.rb and 1 other location - About 1 hr to fix
                      app/helpers/msip/formato_fecha_helper.rb on lines 230..241

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

                      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 inicio_semestre_ant
                            hoy = Time.zone.today
                            anio = hoy.year
                            if hoy.mon >= 7 && hoy.mon < 12
                              ini = anio.to_s + "-" + "01-01"
                      Severity: Major
                      Found in app/helpers/msip/formato_fecha_helper.rb and 1 other location - About 1 hr to fix
                      app/helpers/msip/formato_fecha_helper.rb on lines 248..259

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

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

                                def presenta_nombre(opciones = {})
                                  sep = ""
                                  r = ""
                                  if opciones[:sin_pais].nil? && pais
                                    r = pais.nombre
                      Severity: Minor
                      Found in lib/msip/concerns/models/ubicacion.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 remplazarOpcionesSelect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        static remplazarOpcionesSelect(
                          idElemento, nuevasop, usatomselect = false, cid = 'id',
                          cetiqueta = 'nombre', opvacia = false
                        ) {
                          let elemento = document.getElementById(idElemento)
                      Severity: Minor
                      Found in app/javascript/controllers/motor.js - 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

                      Severity
                      Category
                      Status
                      Source
                      Language