pasosdeJesus/sivel2_gen

View on GitHub

Showing 228 of 380 total issues

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

          def reportar
            authorize! :read, Sivel2Gen::Caso
            @rango_fechas = 'Fecha del hecho'
            @titulo = 'Reporte de casos repetidos'
            @repetidos = []
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb - About 1 hr to fix

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

              def importa(datosent, datossal, menserror, opciones = {})
                ## Verifica que sí es un presunto responsable
                pres = Sivel2Gen::Presponsable.
                  where('upper(nombre COLLATE es_co_utf_8)=upper(? COLLATE es_co_utf_8)', datosent['nombre_grupo'])
                unless pres.empty?
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/caso_presponsable.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 filtra_por_tviolencia has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

              def filtra_por_tviolencia
                datos = []
                if params[:tviolencia] && Sivel2Gen::Supracategoria.where(
                    tviolencia_id: params[:tviolencia]).count > 0
    
    
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/categorias_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 victimizaciones_gen_tabla has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function armarRutaConsulta has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        armarRutaConsulta(rutaSinPuntomontaje, usuarioAutenticado) {
          var ruta = window.puntomontaje + rutaSinPuntomontaje;
          var desde = document.getElementById('campo-desde').value;
          var hasta = document.getElementById('campo-hasta').value;
          var departamento = document.getElementById('departamento').value;
      Severity: Minor
      Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

        Function agregarCasosOsm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          agregarCasosOsm(usuario_autenticado) {
            if (typeof window.formato_fecha === 'undefined') {
              msip_prepara_eventos_comunes(window);
            }
            var urlSolicitud = this.armarRutaConsulta('casos.json', usuario_autenticado);
        Severity: Minor
        Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

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

                    def nuevo
                      if params[:caso_id]
                        @grupoper = Msip::Grupoper.new
                        @victimacolectiva = Victimacolectiva.new
                        @grupoper.nombre = 'N'

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

                      def departamento_caso
                        r = ''
                        if self.caso && self.caso.ubicacionprincipal
                          if self.caso.ubicacionprincipal.pais_id == Msip.paisomision
                            r += self.caso.ubicacionprincipal.departamento ?
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/victima.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 obtener_info_victimas has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              obtener_info_victimas(victimas, prresp, caso) {
                var victimasCont = '<div><table>' +
                  '<tr><td>Víctimas:</td><td>';
                for (var cv in victimas) {
                  if (victimas.hasOwnProperty(cv)) {
            Severity: Minor
            Found in app/javascript/controllers/mapaosm_controller.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

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

                      def importa(datosent, datossal, menserror, opciones = {})
                        victimas = datosent[0]
                        d = datosent[1]
                        if d['id_victima_individual']
                          self.presponsable_id = d['id_presunto_responsable_individual'].to_i
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/acto.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 importa has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def importa(datosent, datossal, menserror, opciones = {})
                        victimascol = datosent[0]
                        d = datosent[1]
                        if d['id_grupo_victima']
                          self.presponsable_id = d['id_presunto_grupo_responsable']
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/actocolectivo.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 consulta has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def consulta
                        authorize! :contar, Sivel2Gen::Caso
            
                        arma_estructuras
            
            
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_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 filtra_por_tviolencia has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def filtra_por_tviolencia
                        datos = []
                        if params[:tviolencia] && Sivel2Gen::Supracategoria.where(
                            tviolencia_id: params[:tviolencia]).count > 0
            
            
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/categorias_controller.rb - About 1 hr to fix

              Method filtros_victimizaciones_gen has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                          pFini, pFfin, pTviolencia, pEtiqueta1, pEtiqueta2, 
                          pExcluirCateRep, pSegun, pDepartamento, pMunicipio, otro= nil,
                          pCategoria = nil)
              Severity: Major
              Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - 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

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

                      Severity
                      Category
                      Status
                      Source
                      Language