pasosdeJesus/sivel2_gen

View on GitHub

Showing 380 of 380 total issues

Method calcula_de_depmun has 26 lines of code (exceeds 25 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

    Method lista has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def lista
                if params[:tabla]
                  r = nil
                  if (params[:tabla] == "departamento" && params[:pais_id].to_i > 0)
                    r = Msip::Departamento.where(fechadeshabilitacion: nil,
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

      Method embeber_mapacalormuncol_svg has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            depid, depcad, titulo, subtitulo, titulorangos, fuente, 
            cantidadesmun, opciones = {})
      Severity: Major
      Found in app/helpers/sivel2_gen/vista_helper.rb - About 1 hr to fix

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

                  def personas_segun_tipico(tabla, nomtabla, que1, que3, tablas3, where3)
                    que1 = agregar_tabla(
                      que1, "victima.#{tabla}_id AS #{tabla}_id")
                    tablas3 = agregar_tabla(
                      tablas3, "public.sivel2_gen_#{tabla} AS #{tabla}")
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb on lines 219..227

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

        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

                  def desagregarpor_tipico(tabla, nomtabla, que1, que3, tablas3, where3)
                    que1 = agregar_tabla(
                      que1, "victima.#{tabla}_id AS #{tabla}_id")
                    tablas3 = agregar_tabla(
                      tablas3, "public.sivel2_gen_#{tabla} AS #{tabla}")
        lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 194..202

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

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

                def graficar_sexo
                  series_gen= []
                  if (@vic_dep.count == 0) || (@vic_categorias.count == 0)
                    flash.now[:info] = "Uno de los filros se encuentra vacío"
                  else
        Severity: Minor
        Found in app/controllers/sivel2_gen/fil23_gen/graficar_apexcharts_controller.rb - About 55 mins 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 sin_identificacion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                  def sin_identificacion
                    if nombres == "N" && apellidos == "N"
                      caso = Sivel2Gen::Victima.where(persona_id: self.id)[0].caso_id
                      vics = Sivel2Gen::Victima.where(caso_id: caso)
                      hv = {}
        Severity: Minor
        Found in lib/sivel2_gen/concerns/models/persona.rb - About 55 mins 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

                          genvic_tabla(
                            'Lesiones físicas', 
                            [
                              {"cat" => [23, 33],
                               "titulo" => "Victimizaciones por `Lesión Física´ por Abuso de Autoridad e Intolerancia Social por agentes directos o indirectos del Estado (Violaciones a los Derechos Humanos)"},
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 592..608

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

        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

                          genvic_tabla(
                            'Ejecuciones extrajudiciales, homicidios y asesinatos', 
                            [
                              {"cat" => [20, 30],
                               "titulo" => "Víctimas de `Ejecución Extrajudicial´ por Abuso de Autoridad e Intolerancia Social por agentes directos o indirectos del Estado (Violaciones a los Derechos Humanos)"},
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 646..661

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

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

                  def pestanas_formulariocaso
                    #byebug
                    if current_usuario && can?(:solocambiaretiquetas, Sivel2Gen::Caso)
                      [
                        { titulo: 'Etiquetas', parcial: 'etiquetas'},
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 55 mins 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

                      col = actocolectivo.inject('') { 
                        |memo, a| 
                        r = (memo == '' ? '' : memo + '; ')
                        r += a.presponsable.nombre
                        r += " : " + a.categoria.supracategoria.tviolencia_id + 
        Severity: Minor
        Found in lib/sivel2_gen/concerns/models/caso.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/models/caso.rb on lines 678..685

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

        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

          module Concerns
            module Controllers
              module CasoFotrasController
                extend ActiveSupport::Concern
        
        
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/caso_fotras_controller.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/controllers/caso_presponsables_controller.rb on lines 4..31

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

        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

          module Concerns
            module Controllers
              module CasoPresponsablesController
                extend ActiveSupport::Concern
        
        
        lib/sivel2_gen/concerns/controllers/caso_fotras_controller.rb on lines 2..28

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

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

                  def remplazar
                    @grupoper = Msip::Grupoper.find(params[:grupoper_id].to_i)
                    @caso = Sivel2Gen::Caso.find(params[:caso_id].to_i)
                    @vicol_posicion = params[:vicol_posicion].to_i
                    @caso.current_usuario = current_usuario
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/gruposper_controller.rb - About 55 mins 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

                      ac = acto.inject('') { 
                        |memo, a| 
                        r = (memo == '' ? '' : memo + '; ')
                        r += a.presponsable.nombre
                        r += " : " + a.categoria.supracategoria.tviolencia_id + 
        Severity: Minor
        Found in lib/sivel2_gen/concerns/models/caso.rb and 1 other location - About 55 mins to fix
        lib/sivel2_gen/concerns/models/caso.rb on lines 692..699

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

        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 (event.target.dataset['sivel2Gen-EdadTarget'] == 'edadactual') {
              this.edadTarget.value = null
              this.rangoedadTarget.value = null
            }
        Severity: Major
        Found in app/javascript/controllers/edad_controller.js and 2 other locations - About 55 mins to fix
        app/javascript/controllers/edad_controller.js on lines 116..119
        app/javascript/controllers/edad_controller.js on lines 120..123

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

        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 (event.target.dataset['sivel2Gen-EdadTarget'] == 'edad') {
              this.rangoedadTarget.value = null
              this.edadactualTarget.value = null
            }
        Severity: Major
        Found in app/javascript/controllers/edad_controller.js and 2 other locations - About 55 mins to fix
        app/javascript/controllers/edad_controller.js on lines 116..119
        app/javascript/controllers/edad_controller.js on lines 124..127

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

        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 (event.target.dataset['sivel2Gen-EdadTarget'] == 'rangoedad') {
              this.edadTarget.value = null
              this.edadactualTarget.value = null
            }
        Severity: Major
        Found in app/javascript/controllers/edad_controller.js and 2 other locations - About 55 mins to fix
        app/javascript/controllers/edad_controller.js on lines 120..123
        app/javascript/controllers/edad_controller.js on lines 124..127

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

        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 poblacion_por_sexo_rango has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def poblacion_por_sexo_rango(caso_id, anio, mes, dia, modelorango, rangoedad, totsexo)
        Severity: Major
        Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix

          Method poblacion_por_rango_sexo has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def poblacion_por_rango_sexo(caso_id, anio, mes, dia, modelorango, 
                                           rangoedadsexo, totsexo)
          Severity: Major
          Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix
            Severity
            Category
            Status
            Source
            Language