pasosdeJesus/sivel2_gen

View on GitHub

Showing 380 of 380 total issues

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

    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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                if opciones[:colormax_r].present? && opciones[:colormax_v].present? && 
                    opciones[:colormax_a].present?
                  crt = opciones[:colormax_r].to_i 
                  cvt = opciones[:colormax_v].to_i 
                  cat = opciones[:colormax_a].to_i 
          Severity: Major
          Found in app/helpers/sivel2_gen/vista_helper.rb and 1 other location - About 1 hr to fix
          app/helpers/sivel2_gen/vista_helper.rb on lines 326..336

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 62.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                if opciones[:colormax_r].present? && opciones[:colormax_v].present? && 
                    opciones[:colormax_a].present?
                  crt = opciones[:colormax_r].to_i 
                  cvt = opciones[:colormax_v].to_i 
                  cat = opciones[:colormax_a].to_i 
          Severity: Major
          Found in app/helpers/sivel2_gen/vista_helper.rb and 1 other location - About 1 hr to fix
          app/helpers/sivel2_gen/vista_helper.rb on lines 72..82

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 62.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                          if r[:metodo_id] == :id
                            ids = r[:coleccion].where(
                              id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.
                              map(&:to_i)
                            ).pluck(:id)
          lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 154..164

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                          if r[:metodo_id] == :id
                            ids = r[:coleccion].where(
                              id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.
                              map(&:to_i)
                            ).pluck(:id)
          Severity: Major
          Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 1 hr to fix
          lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb on lines 152..161

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                  Similar blocks of code found in 9 locations. Consider refactoring.
                  Open

                                if v['sector_condicion']
                                  if Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).count == 1
                                    self.sectorsocial_id = Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).ids[0]
                                  else
                                    menserror << "En la tabla Sector social no existe " +
                  Severity: Major
                  Found in lib/sivel2_gen/concerns/models/combatiente.rb and 8 other locations - About 1 hr to fix
                  lib/sivel2_gen/concerns/models/combatiente.rb on lines 65..76
                  lib/sivel2_gen/concerns/models/combatiente.rb on lines 80..91
                  lib/sivel2_gen/concerns/models/combatiente.rb on lines 111..122
                  lib/sivel2_gen/concerns/models/combatiente.rb on lines 126..137
                  lib/sivel2_gen/concerns/models/victima.rb on lines 401..412
                  lib/sivel2_gen/concerns/models/victima.rb on lines 416..427
                  lib/sivel2_gen/concerns/models/victima.rb on lines 431..442
                  lib/sivel2_gen/concerns/models/victima.rb on lines 446..457

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 59.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language