pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

Method victimizaciones has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def victimizaciones
            authorize! :contar, Sivel2Gen::Caso

            # Filtros
            pFini = escapar_param(params, [:filtro, 'fechaini'])
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/mapadep_controller.rb - About 2 hrs to fix

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

                    r.each do |t|
                      if !inter[t[fila]]
                        inter[t[fila]] = {}
                      end
                      if !inter[t[fila]][t['rotulo']]
    Severity: Major
    Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 2 hrs to fix
    lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 1099..1111

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

    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

                    r.each do |t|
                      if !inter[t[fila]]
                        inter[t[fila]] = {}
                      end
                      if !inter[t[fila]][t['categoria']]
    Severity: Major
    Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 2 hrs to fix
    lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 1190..1202

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

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

              def self.asegura_camposdinamicos(caso, current_usuario_id, pestanas)
                if caso.nil?  || caso.id.nil?
                  return
                end
    
    
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

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

        static iniciar() {
          console.log("Sivel2Gen__AutocompletaAjaxFamiliares")
          let url = window.puntoMontaje + 'personas.json'
          var asistentes = new window.AutocompletaAjaxExpreg(
            [
      Severity: Major
      Found in app/javascript/controllers/AutocompletaAjaxFamiliares.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/AutocompletaAjaxVictimas.js on lines 45..57

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

      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

          if (hoy.getMonth() < fechaNacimiento.getMonth() ||
            (hoy.getMonth() === fechaNacimiento.getMonth() &&
              hoy.getDate() < fechaNacimiento.getDate())
          ) {
            edadactual--;
      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 80..85

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

      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

        static iniciar() {
          console.log("Sivel2Gen__AutocompletaAjaxVictimas")
          let url = window.puntoMontaje + 'personas.json'
          var asistentes = new window.AutocompletaAjaxExpreg(
            [ /^caso_victima_attributes_[0-9]*_persona_attributes_nombres$/,
      Severity: Major
      Found in app/javascript/controllers/AutocompletaAjaxVictimas.js and 1 other location - About 1 hr to fix
      app/javascript/controllers/AutocompletaAjaxFamiliares.js on lines 50..63

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

      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

          if (fechaCaso.getMonth() < fechaNacimiento.getMonth() ||
            (fechaCaso.getMonth() === fechaNacimiento.getMonth() &&
              fechaCaso.getDate() < fechaNacimiento.getDate())
          ) {
            edad--;
      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 74..79

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

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

                def personas
                  authorize! :contar, Sivel2Gen::Caso
      
                  @pSegun = escapar_param(params, [:filtro, 'segun'])
                  @pMunicipio = escapar_param(params, [:filtro, 'municipio'])
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method victimizaciones has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

                def victimizaciones
                  authorize! :contar, Sivel2Gen::Caso
      
                  # Filtros
                  pFini = escapar_param(params, [:filtro, 'fechaini'])
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/mapadep_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 @victimacolectiva.save
                      respond_to do |format|
                        format.js { render json: {
                          'victimacolectiva' => @victimacolectiva.id.to_s,
                          'grupoper' => @grupoper.id.to_s} }
      lib/sivel2_gen/concerns/controllers/victimas_controller.rb on lines 90..104

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

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

                def show_sivel2_gen
                  if !Rails.configuration.x.sivel2_consulta_web_publica
                    authorize! :read, Sivel2Gen::Caso
                  end
      
      
      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 @victima.save
                      respond_to do |format|
                        format.js { render json: {'victima' => @victima.id.to_s,
                                                  'persona' => @persona.id.to_s} }
                        format.json { render json: {'victima' => @victima.id.to_s,
      Severity: Major
      Found in lib/sivel2_gen/concerns/controllers/victimas_controller.rb and 1 other location - About 1 hr to fix
      lib/sivel2_gen/concerns/controllers/victimascolectivas_controller.rb on lines 34..50

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

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

        connect() {
          console.log("Conexion de controlador Mapa osm");
          const usuarioAutenticado = this.data.get("usuarioAutenticado") === 'true';
          if (!this.constructor.marcadores) {
            this.constructor.marcadores = L.markerClusterGroup();
      Severity: Minor
      Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

        Method actos_individuales has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def actos_individuales
                authorize! :contar, Sivel2Gen::Caso
        
                @rutadircsv = File.join(
                  Rails.root, "public#{Rails.configuration.relative_url_root}" +
        Severity: Minor
        Found in app/controllers/sivel2_gen/fil23_gen/graficar_plotly_controller.rb - About 1 hr to fix

          Function clicMarcadorCaso has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function clicMarcadorCaso() {
                self.mostrarCargador();
                Msip__Motor.arreglarPuntomontaje();
                var ruta = window.puntoMontaje + 'casos/';
                var urlSolicitud = ruta + codigo + ".json";  
          Severity: Minor
          Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

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

                    if (pestania.id == pestanaActiva) {
                      pestania.classList.add('active');
                      const atributoId = pestania.getAttribute('data-bs-target');
                      const atributo = document.querySelector(atributoId);
                      if (atributo) {
            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 26..33

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

            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

                    } else {
                      pestania.classList.remove('active');
                      const atributoId = pestania.getAttribute('data-bs-target');
                      const atributo = document.querySelector(atributoId);
                      if (atributo) {
            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 19..26

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

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

                      def nuevo
                        if params[:caso_id]
                          @persona = Msip::Persona.new
                          @victima = Victima.new
                          @persona.nombres = 'N'
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/victimas_controller.rb - About 1 hr to fix

              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/acto.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language