pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

Function operarElegida has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static operarElegida (eorig, cadpersona, id, otrosop) {
    Msip__Motor.arreglarPuntomontaje()
    vic_position = eorig.target.id.split("_")[3]
    const cs = id.split(';')
    const idPersona = cs[0]
Severity: Minor
Found in app/javascript/controllers/AutocompletaAjaxVictimas.js - About 1 hr to fix

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

              def consulta_base_sivel2_gen
                r = "SELECT caso.id as caso_id, caso.fecha, caso.memo, 
            ARRAY_TO_STRING(ARRAY(SELECT COALESCE(departamento.nombre, '') ||  
            ' / ' || COALESCE(municipio.nombre, '')
            FROM public.msip_ubicacion AS ubicacion 
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/conscaso.rb - About 1 hr to fix

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

                def importa(datosent, datossal, menserror, opciones = {})
                  pais = Msip::Pais.
                    where('nombre ILIKE ?', datosent['pais']).ids[0]
                  self.pais_id = pais || Msip.paisomision 
                  dep = Msip::Departamento.
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/ubicacion.rb - About 1 hr to fix

        Function operarElegida has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static operarElegida (eorig, cadgrupo, idGrupo, otrosop) {
            Msip__Motor.arreglarPuntomontaje()
            vicol_posicion = eorig.target.id.split("_")[3]
            const divcp = eorig.target.closest('.' +
                Sivel2Gen__AutocompletaAjaxColectivas.claseEnvoltura)
        Severity: Minor
        Found in app/javascript/controllers/AutocompletaAjaxColectivas.js - About 1 hr to fix

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

                    def arma_estfiltrosm_gen
                      f = {
                        'CATEGORIAS' => {
                          nomfiltro: nil,
                          coleccion: nil,

            Method genconsulta_victimizaciones has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        pFini, pFfin, pTviolencia, pEtiqueta1, pEtiqueta2, pExcluirCateRep,
                        pSegun, pDepartamento, pMunicipio, pCategoria = nil)
            Severity: Major
            Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

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

                  def formato_ubicacion u, con_centropoblado = true
                    r = "";
                    if u
                      r = Msip::Pais.find(u.pais_id).nombre
                      if u.departamento_id
              Severity: Minor
              Found in app/helpers/sivel2_gen/ubicacion_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 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/sivel2_gen/rangoedad_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 nueva has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                        def nueva
                          if params[:caso_id]
                            @casoetiqueta = Sivel2Gen::CasoEtiqueta.new
                            @casoetiqueta.caso_id = params[:caso_id]
                            @casoetiqueta.etiqueta_id = Msip::Etiqueta.count > 0 ? Msip::Etiqueta.take.id : 0
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/caso_etiquetas_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 genvic_tabla has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                        def genvic_tabla(titulo, filas, tittotales, where1)
                          cuerpo = []
                          tot = 0;
                          filas.each do |f|
                            s = 0;
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/conteos_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 calcula_de_depmun has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                        def calcula_de_depmun(departamento_id, municipio_id)
                          if departamento_id && 
                              Sivel2Gen::DepartamentoRegion.where(
                                departamento_id: departamento_id).count > 0
                            dr = Sivel2Gen::DepartamentoRegion.
              Severity: Minor
              Found in lib/sivel2_gen/concerns/models/region.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 mapaosm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                        def mapaosm
                          if !Rails.configuration.x.sivel2_consulta_web_publica
                            authorize! :index, Sivel2Gen::Caso
                          end
              
              
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/casos_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 refresca_conscaso has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def refresca_conscaso
                          if ARGV.include?("db:migrate")
                            return 'Ejecutando migración'
                          end
                          if !ActiveRecord::Base.connection.data_source_exists? 'sivel2_gen_conscaso'
              Severity: Minor
              Found in lib/sivel2_gen/concerns/models/conscaso.rb - About 1 hr to fix

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

                  static ejecutarAlCargarDocumentoYRecursos() {
                    console.log("* Corriendo Sivel2Gen__Motor::ejecutarAlCargarDocumentoYRecursos()")
                
                    if (typeof window.puntoMontaje == 'undefined') {
                      window.puntoMontaje = '/'
                Severity: Minor
                Found in app/javascript/controllers/motor.js - About 1 hr to fix

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

                    procesar_datos(filas, variable) {
                      var dicEtiquetas = {}
                      filas.forEach(function(r) {
                        dicEtiquetas[r[variable]] = 0
                        if (typeof datosr[r.fecha] == 'undefined') {
                  Severity: Minor
                  Found in app/javascript/controllers/plotly_actos_controller.js - About 1 hr to fix

                    Method atributos_show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def atributos_show
                                [
                                  # basicos
                                  :id,
                                  :fecha,
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

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

                                def sivel2_gen_victima_presenta(atr)
                                  case atr.to_s
                                  when 'fecha_caso'
                                    self.caso ? self.caso.fecha : ''
                                  when 'nombre'
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/models/victima.rb - About 1 hr to fix

                        Method remplazarfamiliar has 29 lines of code (exceeds 25 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 1 hr to fix

                          Method personas_procesa_filtros_sivel2_gen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def personas_procesa_filtros_sivel2_gen(que1, tablas1, where1, que3, 
                                                                            tablas3, where3)
                                      @filtrosegun.each do |e, r|
                                        if (params[:filtro] && params[:filtro][r[:nomfiltro]] && 
                                            params[:filtro][r[:nomfiltro]] != '') 
                          Severity: Minor
                          Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

                            Method nomrango has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                      def self.nomrango(fechaini, fechafin)
                                        if !fechaini
                                          return "Sin fechaini"
                                        end
                                        if !fechafin
                            Severity: Minor
                            Found in lib/sivel2_gen/concerns/controllers/mapadep_controller.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language