pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

Method lista has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def lista
            if params[:tabla]
              r = nil
              if (params[:tabla] == "departamento" && params[:pais_id].to_i > 0)
                r = Msip::Departamento.where(fechadeshabilitacion: nil,
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                        if victima_params[:persona_attributes][:id] != ""
                          vics = Sivel2Gen::Victima.where(
                            persona_id: victima_params[:persona_attributes][:id])
                          if vics.count > 0
                            vic = vics[0]
Severity: Major
Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                          if victima_params[:id] == ""
                            if victima_creada == false
                              vic = Sivel2Gen::Victima.create(victima_params)
                              victima_creada = true
                            end
    Severity: Major
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                            if pt.count > 0
                              params[:caso][:victima_attributes][victima_indice][:persona_attributes][:persona_trelacion1_attributes][persona_indice][:id] = pt[0].id
                            else
                              ptn = Msip::PersonaTrelacion.create(
                                persona1: vic.persona.id , persona2: p2_id
      Severity: Major
      Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

        Method validacion_estandar has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                  def validacion_estandar(casos, titulo, where, 
                                          atr = [:id, :fecha, :nusuario],
                                          encabezado = [
                                            'Código', 'Fecha del Hecho', 'Usuario'],
                                         ordenapor = 'fecha')
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/validarcasos_controller.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                if victima_params[:id] != ""
                                  vic = Sivel2Gen::Victima.find(victima_params[:id].to_i)
                                else
                                  victima_params_filtrado = victima_params.deep_dup.tap do |params|
                                    params[:persona_attributes].delete(:persona_trelacion1_attributes)
          Severity: Major
          Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 && 
                        dianac > dia)
                      na -= 1
                    end
            Severity: Major
            Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
                        cr = crt
                        cv = cvt
                        ca = cat
                      end
              Severity: Major
              Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
                          cr = crt
                          cv = cvt
                          ca = cat
                        end
                Severity: Major
                Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

                  Method importa has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                            def importa(datosent, datossal, formato_sexo, menserror, opciones = {})
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/models/victima.rb - About 35 mins to fix

                    Method importa has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                              def importa(datosent, datossal, formato_sexo,
                                          menserror, opciones = {})
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/models/caso.rb - About 35 mins to fix

                      Method buscar_rango_edad has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def buscar_rango_edad(edad, modelorango)
                            if (!modelorango || !defined?(modelorango.constantize) || 
                                !defined?(!modelorango.constantize.habilitados))
                              puts "No se pudo usar modelorango"
                              return -1
                      Severity: Minor
                      Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 35 mins 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 presenta_arbol_presp_ul_li has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def presenta_arbol_presp_ul_li(nivel, arbol, opciones={})
                            subarbol = ''
                            if arbol && arbol[:hijos] && arbol[:hijos].count > 0
                              subarbol = "<ul>\n".html_safe + arbol[:hijos].map{|h| 
                                "<li>".html_safe + 
                      Severity: Minor
                      Found in app/helpers/sivel2_gen/vista_helper.rb - About 35 mins 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 procesa_un_filtrom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def procesa_un_filtrom(where1, r, ids)
                                  if r[:nomfiltro] == :aniosnac
                                    where1 += (where1 != '' ? ' AND ' : '') + 
                                      "(persona.anionac IS NULL OR persona.anionac IN ('" +
                                      ids.sort.join("', '") + "'))"
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 35 mins 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 genvic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def genvic
                                  authorize! :contar, Sivel2Gen::Caso
                      
                                  where1 = '';
                                  @fechaini = '';
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 35 mins 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 principal= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def principal=(v)
                                  if self.id && self.caso
                                    if v.to_i == 1
                                      self.caso.update_attribute('ubicacion_id', self.id)
                                    elsif self.caso.ubicacion_id == self.id
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/models/ubicacion.rb - About 35 mins 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 presentarMapaOsm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        presentarMapaOsm(usuario_autenticado) {
                          var usuario_aut_global = usuario_autenticado;
                          // Borrar clase container y ocultar pie de página
                          document.querySelector('.navbar').classList.add('navbarosm');
                          document.querySelector('.card-body').classList.add('cardbodyosm');
                      Severity: Minor
                      Found in app/javascript/controllers/mapaosm_controller.js - About 35 mins 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 actualizarTrazosPresentados has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        actualizarTrazosPresentados(etiquetas) {
                          var etiquetasP = []
                          var i = 0
                          trazosPresentados.forEach(function(t) {
                            etiquetasP.push(t.name)
                      Severity: Minor
                      Found in app/javascript/controllers/plotly_actos_controller.js - About 35 mins 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 remplazarfamiliar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def remplazarfamiliar
                                  @caso = Sivel2Gen::Caso.find(params[:caso_id])
                                  @caso.current_usuario = current_usuario
                                  @personados = Msip::Persona.find(params[:persona_id].to_i)
                                  @vic_position = params[:vic_position].to_i
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/personas_controller.rb - About 35 mins 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 nuevo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def nuevo
                                  if !params[:caso_id].nil?
                                    @presponsable = CasoPresponsable.new
                                    @presponsable.caso_id = params[:caso_id]
                                    @presponsable.presponsable_id = 35
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/presponsables_controller.rb - About 35 mins 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