pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

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

          def create
            @caso.current_usuario = current_usuario
            @caso.memo = ''
            @caso.titulo = ''

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

          def filtro_avanzado(conscaso, params_filtro)
            for i in campos_filtro1_gen do
              if params_filtro[i] && params_filtro[i] != '' &&
                params_filtro[i] != [''] &&
                conscaso.respond_to?('filtro_' + i.to_s)
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 procesa_desagregarpor_om has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def procesa_desagregarpor_om(que1, tablas1, where1, que3, tablas3, where3)

            case @pDesagregarpor
            when ''
              que1 = agregar_tabla(que1, 'cast(\'total\' as text) as total')
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 1 hr to fix

    Function ejecutarAlCargarPagina has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static ejecutarAlCargarPagina() {
        console.log("* Corriendo Sivel2Gen__Motor::ejecutarAlCargarPagina()")
      
        // Envia formulario al presionar botones con clase fichacambia 
        // con más de 5 segundos de diferencia entre un click y el siguiente
    Severity: Minor
    Found in app/javascript/controllers/motor.js - About 1 hr to fix

      Method create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def create
                  @caso.current_usuario = current_usuario
                  @caso.memo = ''
                  @caso.titulo = ''
      
      
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

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

              static operarElegida (eorig, cadpersona, id, otrosop) {
                vic_position = eorig.target.id.split("_")[3]
                fam_position = eorig.target.id.split("_")[9]
                Msip__Motor.arreglarPuntomontaje()
                const cs = id.split(';')
            Severity: Minor
            Found in app/javascript/controllers/AutocompletaAjaxFamiliares.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__Mootr.preparaEventosComunes();
                  }
                  var urlSolicitud = this.armarRutaConsulta('casos.json', usuario_autenticado);
              Severity: Minor
              Found in app/javascript/controllers/mapaosm_controller.js - 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

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

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

                    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 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
                        Severity
                        Category
                        Status
                        Source
                        Language