pasosdeJesus/sivel2_gen

View on GitHub

Showing 380 of 380 total issues

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

    if (this.constructor.agregaCapaDiv != undefined) { // si había información se elimina
      this.constructor.agregaCapaDiv.remove(this.constructor.mapa);
    }
Severity: Minor
Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 40 mins to fix
app/javascript/controllers/mapaosm_controller.js on lines 369..371

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

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 (this.constructor.info != undefined) { // si ya tenía información se quita primero
      this.constructor.info.remove(this.constructor.mapa); 
    }
Severity: Minor
Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 40 mins to fix
app/javascript/controllers/mapaosm_controller.js on lines 451..453

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

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

          def importa(datosent, datossal, formato_sexo,
                      menserror, opciones = {})
Severity: Minor
Found in lib/sivel2_gen/concerns/models/caso.rb - About 35 mins to fix

    Method importa has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def importa(datosent, datossal, formato_sexo, menserror, opciones = {})
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/victima.rb - About 35 mins to fix

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

                      { titulo: 'Datos Básicos', parcial: 'basicos'},
                      { titulo: 'Ubicación', parcial: 'ubicaciones'},
                      { titulo: 'Fuentes Frecuentes', parcial: 'fuentesprensa'},
                      { titulo: 'Otras Fuentes', parcial: 'fotras'},
                      { titulo: 'Contexto', parcial: 'contextos'},
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb and 1 other location - About 35 mins to fix
      lib/sivel2_gen/concerns/controllers/casos_controller.rb on lines 647..653

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

      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

                    when 'filiacion'
                      if Sivel2Gen::Filiacion.where('TRIM(nombre)=?', ele[1].strip).count ==1
                        self.filiacion_id = Sivel2Gen::Filiacion.
                          where('TRIM(nombre)=?', ele[1].strip).ids[0]
                      else
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/victima.rb and 2 other locations - About 35 mins to fix
      lib/sivel2_gen/concerns/models/combatiente.rb on lines 144..149
      lib/sivel2_gen/concerns/models/victima.rb on lines 471..477

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

      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

                      { titulo: 'Víctimas Colectivas', parcial: 'victimascolectivas'},
                      { titulo: 'Combatientes', parcial: 'combatientes'},
                      { titulo: 'Actos', parcial: 'actos'},
                      { titulo: 'Descripción', parcial: 'memo'},
                      { titulo: 'Anexos', parcial: 'sivel2_gen/casos/anexos'},
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb and 1 other location - About 35 mins to fix
      lib/sivel2_gen/concerns/controllers/casos_controller.rb on lines 635..641

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

      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

                    when 'vinculoestado'
                      if Sivel2Gen::Vinculoestado.where(
                          'TRIM(nombre)=?', ele[1].strip).count ==1
                        self.vinculoestado_id = Sivel2Gen::Vinculoestado.
                          where('TRIM(nombre)=?', ele[1].strip).ids[0]
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/victima.rb and 2 other locations - About 35 mins to fix
      lib/sivel2_gen/concerns/models/combatiente.rb on lines 144..149
      lib/sivel2_gen/concerns/models/victima.rb on lines 464..469

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

      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

                      when 'filiacion'
                        if Sivel2Gen::Filiacion.where('TRIM(nombre)=?', ele[1].strip).count ==1
                          self.filiacion_id = Sivel2Gen::Filiacion.
                            where('TRIM(nombre)=?', ele[1].strip).ids[0]
                        else
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/combatiente.rb and 2 other locations - About 35 mins to fix
      lib/sivel2_gen/concerns/models/victima.rb on lines 464..469
      lib/sivel2_gen/concerns/models/victima.rb on lines 471..477

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

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

          def presenta_arbol_presp_ul_li(nivel, arbol, opciones={})
            subarbol = ''
            if arbol && arbol[:hijos] && arbol[:hijos].count > 0
              subarbol = "<ul>\n".html_safe + arbol[:hijos].map{|h| 
                "<li>".html_safe + 
      Severity: Minor
      Found in app/helpers/sivel2_gen/vista_helper.rb - About 35 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 buscar_rango_edad has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def buscar_rango_edad(edad, modelorango)
            if (!modelorango || !defined?(modelorango.constantize) || 
                !defined?(!modelorango.constantize.habilitados))
              puts "No se pudo usar modelorango"
              return -1
      Severity: Minor
      Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 35 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 principal= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def principal=(v)
                  if self.id && self.caso
                    if v.to_i == 1
                      self.caso.update_attribute('ubicacion_id', self.id)
                    elsif self.caso.ubicacion_id == self.id
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/ubicacion.rb - About 35 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 procesa_un_filtrom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def procesa_un_filtrom(where1, r, ids)
                  if r[:nomfiltro] == :aniosnac
                    where1 += (where1 != '' ? ' AND ' : '') + 
                      "(persona.anionac IS NULL OR persona.anionac IN ('" +
                      ids.sort.join("', '") + "'))"
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 35 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

      Function presentarMapaOsm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        presentarMapaOsm(usuario_autenticado) {
          var usuario_aut_global = usuario_autenticado;
          // Borrar clase container y ocultar pie de página
          document.querySelector('.navbar').classList.add('navbarosm');
          document.querySelector('.card-body').classList.add('cardbodyosm');
      Severity: Minor
      Found in app/javascript/controllers/mapaosm_controller.js - About 35 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 genvic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def genvic
                  authorize! :contar, Sivel2Gen::Caso
      
                  where1 = '';
                  @fechaini = '';
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 35 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

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

                      filas.each do |f|
                        ft = [f]
                        et.each do |e|
                          if inter[f] && inter[f][e]
                            ft << inter[f][e]
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 35 mins to fix
      lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 1123..1132

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

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

                def remplazar_sivel2_gen
                  @persona = Msip::Persona.find(params[:persona_id].to_i)
                  @caso = Sivel2Gen::Caso.find(params[:caso_id].to_i)
                  @caso.current_usuario = current_usuario
                  @vic_position = params[:vic_position].to_i
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/personas_controller.rb - About 35 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 remplazarfamiliar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def remplazarfamiliar
                  @caso = Sivel2Gen::Caso.find(params[:caso_id])
                  @caso.current_usuario = current_usuario
                  @personados = Msip::Persona.find(params[:persona_id].to_i)
                  @vic_position = params[:vic_position].to_i
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/personas_controller.rb - About 35 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 nuevo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def nuevo
                  if !params[:caso_id].nil?
                    @presponsable = CasoPresponsable.new
                    @presponsable.caso_id = params[:caso_id]
                    @presponsable.presponsable_id = 35
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/presponsables_controller.rb - About 35 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

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

                      filas.each do |f|
                        ft = [f]
                        et.each do |e|
                          if inter[f] && inter[f][e]
                            ft << inter[f][e]
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 35 mins to fix
      lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 1214..1223

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

      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