pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

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

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

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

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

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

  actualizarTrazosPresentados(etiquetas) {
    var etiquetasP = []
    var i = 0
    trazosPresentados.forEach(function(t) {
      etiquetasP.push(t.name)
Severity: Minor
Found in app/javascript/controllers/plotly_actos_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 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

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

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

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

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

          respond_to do |format|
            format.js { render text: @ubicacion.id.to_s }
            format.json { render json: @ubicacion.id.to_s, status: :created }
            format.html { render inline: @ubicacion.id.to_s }
Severity: Major
Found in app/controllers/sivel2_gen/ubicaciones_controller.rb and 3 other locations - About 30 mins to fix
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 35..38
lib/sivel2_gen/concerns/controllers/caso_etiquetas_controller.rb on lines 22..25
lib/sivel2_gen/concerns/controllers/presponsables_controller.rb on lines 59..62

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

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 4 locations. Consider refactoring.
Open

        respond_to do |format|
          format.js { render text: @ubicacion.id.to_s }
          format.json { render json: @ubicacion.id.to_s, status: :updated }
          format.html { render inline: @ubicacion.id.to_s }
Severity: Major
Found in app/controllers/sivel2_gen/ubicaciones_controller.rb and 3 other locations - About 30 mins to fix
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 15..18
lib/sivel2_gen/concerns/controllers/caso_etiquetas_controller.rb on lines 22..25
lib/sivel2_gen/concerns/controllers/presponsables_controller.rb on lines 59..62

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

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 4 locations. Consider refactoring.
Open

                respond_to do |format|
                  format.js { render text: @casoetiqueta.id.to_s }
                  format.json { render json: @casoetiqueta.id.to_s, status: :created }
                  format.html { render inline: @casoetiqueta.id.to_s }
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 15..18
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 35..38
lib/sivel2_gen/concerns/controllers/presponsables_controller.rb on lines 59..62

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

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 4 locations. Consider refactoring.
Open

                respond_to do |format|
                  format.js { render text: @presponsable.id.to_s }
                  format.json { render json: @presponsable.id.to_s, status: :created }
                  format.html { render inline: @presponsable.id.to_s }
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 15..18
app/controllers/sivel2_gen/ubicaciones_controller.rb on lines 35..38
lib/sivel2_gen/concerns/controllers/caso_etiquetas_controller.rb on lines 22..25

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

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 (edadactual > 0 ) {
        this.edadactualTarget.value = edadactual;
      } else {
        this.edadactualTarget.value = 0;
      }
Severity: Minor
Found in app/javascript/controllers/edad_controller.js and 1 other location - About 30 mins to fix
app/javascript/controllers/edad_controller.js on lines 86..90

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

Avoid too many return statements within this method.
Open

                  return
Severity: Major
Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                      return
    Severity: Major
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                        return
      Severity: Major
      Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                          return
        Severity: Major
        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                            return
          Severity: Major
          Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language