pasosdeJesus/msip

View on GitHub

Showing 214 of 272 total issues

Method reconoce_adivinando_locale has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def reconoce_adivinando_locale(f, menserror = nil)
      if !f || (f.class != String && f.class != Date) ||
          (f.class == String && f == "")
        return nil
      end
Severity: Minor
Found in app/helpers/msip/formato_fecha_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 dif_meses_dias has a Cognitive Complexity of 14 (exceeds 5 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

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

    def item_acordeon_bs(
      acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
    )
      opciones = opciones_ps.stringify_keys
      content_tag(
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 modelo_path has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def modelo_path(o, posfijo_path = true)
      if o.nil?
        return main_app.root_path
      end

Severity: Minor
Found in app/helpers/msip/modelo_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 carga_semillas_sql has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def self.carga_semillas_sql(conexion, motor, tipoarchivo, patexcluye = nil)
    if tipoarchivo.to_s != "datos" && tipoarchivo.to_s != "cambios"
      raise "Las semillas solo pueden ser cambios o datos"
    end

Severity: Minor
Found in lib/msip.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 43 lines of code (exceeds 25 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

    Function cambia_tdocumento has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      cambia_tdocumento(e) {
        var purl = window.puntomontaje;
        if (purl == "/") {
          purl = "";
        }
    Severity: Minor
    Found in app/javascript/controllers/sindocaut_controller.js - About 1 hr to fix

      Method genera_modelo has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def genera_modelo
            template(
              "tablabasica.rb.erb",
              "app/models/#{nom_arch}.rb",
            )
      Severity: Minor
      Found in lib/generators/msip/asociabasica_generator.rb - About 1 hr to fix

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

            def ruta_responde_0p(n)
              begin
                r = send(n)
                return [n, r]
              rescue NoMethodError
        Severity: Minor
        Found in app/helpers/msip/modelo_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 ruta_responde_1p has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def ruta_responde_1p(n, p)
              begin
                r = send(n, p)
                return [n, r]
              rescue NoMethodError
        Severity: Minor
        Found in app/helpers/msip/modelo_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 asociacion_combinada has a Cognitive Complexity of 13 (exceeds 5 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

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

                  def self.a(ip, usuario_id, url, params,
                    modelo, modelo_id, operacion, detalle_json = "{}")
                    url = url ? url.to_s : ""
                    url = url[0..49] if url && url.length > 50
                    modelo = modelo ? modelo.to_s : ""
        Severity: Minor
        Found in lib/msip/concerns/models/bitacora.rb - About 1 hr to fix

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

                    def index(c = nil)
                      if c.nil?
                        c = Msip::Orgsocial.all
                      end
                      if params[:term]
          Severity: Minor
          Found in lib/msip/concerns/controllers/orgsociales_controller.rb - About 1 hr to fix

            Method nomenclatura has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def nomenclatura(pais, departamento, municipio,
                        centropoblado, vereda, lugar, sitio)
                        if pais.to_s.strip == ""
                          return ['', '']
                        end
            Severity: Minor
            Found in lib/msip/concerns/models/ubicacionpre.rb - About 1 hr to fix

              Method barra_navegacion has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def barra_navegacion(opciones, &bloque)
                    r = content_tag(
                      :nav,
                      class: "navbar navbar-expand-lg navbar-light bg-light",
                    ) do
              Severity: Minor
              Found in app/helpers/msip/bootstrap_helper.rb - About 1 hr to fix

                Method presenta_msip has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def presenta_msip(atr)
                            case atr.to_s
                            when "{:orgsocial_persona=>[]}"
                              if orgsocial_persona
                                orgsocial_persona.inject("") do |memo, s|
                Severity: Minor
                Found in lib/msip/concerns/models/orgsocial.rb - About 1 hr to fix

                  Method index_msip has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def index_msip(c = nil)
                              if c.nil?
                                c = Msip::Persona.all
                              end
                              if params[:term]
                  Severity: Minor
                  Found in lib/msip/concerns/controllers/personas_controller.rb - About 1 hr to fix

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

                              def poner_nombre_estandar
                                self.nombre, self.nombre_sin_pais = Msip::Ubicacionpre.nomenclatura(
                                  pais.nombre,
                                  departamento ? departamento.nombre : "",
                                  municipio ? municipio.nombre : "",
                    Severity: Minor
                    Found in lib/msip/concerns/models/ubicacionpre.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 formato_ubicacion_partes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def formato_ubicacion_partes(pais_id, departamento_id, municipio_id,
                          centropoblado_id, con_centropoblado, con_pais)
                          r = ""
                          if pais_id.nil? || Msip::Pais.where(id: pais_id).count != 1
                            return r
                    Severity: Minor
                    Found in app/helpers/msip/ubicacion_helper.rb - About 1 hr to fix

                      Function msip_ubicacionpre_expandible_busca_lugar has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function msip_ubicacionpre_expandible_busca_lugar(s, ubi) {
                        root = window
                        msip_arregla_puntomontaje(root)
                        cnom = s.attr('id')
                        v = $("#" + cnom).data('autocompleta')
                      Severity: Minor
                      Found in app/assets/javascripts/msip/ubicacionpre.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language