pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

Method valida_categoria_presponsable has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def valida_categoria_presponsable
            consl= "WITH RECURSIVE cteRecursion AS (
               SELECT id, 1 AS Level
                   FROM public.sivel2_gen_presponsable
                   WHERE id = 39
Severity: Minor
Found in lib/sivel2_gen/concerns/models/actocolectivo.rb - About 1 hr to fix

    Method categoria_presponsable has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def categoria_presponsable
                consl= "WITH RECURSIVE cteRecursion AS (
                   SELECT id, 1 AS Level
                       FROM public.sivel2_gen_presponsable
                       WHERE id = 39
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/caso.rb - About 1 hr to fix

      Function filtrar_tviolencia has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        filtrar_tviolencia(e){
          if (e.target && e.target.id === 'filtro_tviolencia_id') {
            var tviolencia_id = e.target.value;
            var select = e.target;
      
      
      Severity: Minor
      Found in app/javascript/controllers/filtro_avanzado_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

      Function filtrar_categoria has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        filtrar_categoria(e){
          if (e.target && e.target.id === 'filtro_categoria_id') {
            var categoria_id = e.target.value;
            var select = e.target;
            var url = window.puntoMontaje + 'admin/categorias/filtratviolencia';
      Severity: Minor
      Found in app/javascript/controllers/filtro_avanzado_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 procesa_filtrosm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

                def procesa_filtrosm(que1, tablas1, where1, que3, 
                                        tablas3, where3)
                  @estfiltrosm.each do |e, r|
                    if (params[:filtro] && params[:filtro][r[:nomfiltro]] && 
                        params[:filtro][r[:nomfiltro]] != '') 
      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

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

          if (event.target.dataset['sivel2Gen-EdadTarget'] == 'edadactual') {
            let edadactual = parseInt(this.edadactualTarget.value)
            anio = hoy.getFullYear() - edadactual
            mes = 0
            dia = 1
      Severity: Major
      Found in app/javascript/controllers/edad_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/edad_controller.js on lines 55..61

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

      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

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

              var id = $(v).find('div').filter(function() {
                return this.attributes.class.value.match(/caso_victimacolectiva[_0-9]*grupoper_id/);
              }).find('input').val();
      Severity: Major
      Found in app/javascript/controllers/enviar_ficha_caso_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/enviar_ficha_caso_controller.js on lines 180..182

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

      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

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

              var nom = $(v).find('div').filter(function() {
                return this.attributes.class.value.match(/caso_victimacolectiva[_0-9]*grupoper_nombre/);
              }).find('input').val();
      Severity: Major
      Found in app/javascript/controllers/enviar_ficha_caso_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/enviar_ficha_caso_controller.js on lines 168..170

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

      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

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

          for (var cv in victimas) {
            if (victimas.hasOwnProperty(cv)) {
              var victima = victimas[cv];
              victimasCont += ((typeof victima != 'undefined') && victima != "") ? victima + '<br />' : 'SIN INFORMACIÓN';
            }
      Severity: Major
      Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/mapaosm_controller.js on lines 355..360

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

      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

      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

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

          if (event.target.dataset['sivel2Gen-EdadTarget'] == 'edad') {
            let edad = parseInt(this.edadTarget.value)
            anio = fechaCaso.getFullYear() - edad
            mes = 0
            dia = 1
      Severity: Major
      Found in app/javascript/controllers/edad_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/edad_controller.js on lines 63..69

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

      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

      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

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

          for (var cp in prresp) {
            if (prresp.hasOwnProperty(cp)) {
              var prrespel = prresp[cp];
              victimasCont += ((typeof prrespel != 'undefined') && prrespel != "") ? prrespel + '<br />' : 'SIN INFORMACIÓN';
            }
      Severity: Major
      Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/mapaosm_controller.js on lines 347..352

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

      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

      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

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

                  if (valor == 'Departamento') {
                    fil_cat.parentElement.style.display = "block"
                    fil_dep.parentElement.style.display = "none"
                    fil_sex.parentElement.style.display = "block"
                  }
          Severity: Major
          Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
          app/javascript/controllers/motor.js on lines 130..134
          app/javascript/controllers/motor.js on lines 135..139

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

          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

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

                  if (valor == 'Categoria') {
                    fil_cat.parentElement.style.display = "none"
                    fil_dep.parentElement.style.display = "block"
                    fil_sex.parentElement.style.display = "block"
                  }
          Severity: Major
          Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
          app/javascript/controllers/motor.js on lines 125..129
          app/javascript/controllers/motor.js on lines 135..139

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

          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

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

                  if (valor == 'Sexo') {
                    fil_cat.parentElement.style.display = "block"
                    fil_dep.parentElement.style.display = "block"
                    fil_sex.parentElement.style.display = "none"
                  }
          Severity: Major
          Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
          app/javascript/controllers/motor.js on lines 125..129
          app/javascript/controllers/motor.js on lines 130..134

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

          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

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