pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

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

            if (params[:buscarrepetido] &&
                params[:buscarrepetido][:fechaini] &&
                params[:buscarrepetido][:fechaini] != '')
              pfi = params[:buscarrepetido][:fechaini]
              pfid = Msip::FormatoFechaHelper.fecha_local_estandar(pfi)
lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb on lines 26..32

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

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

  module Admin
    class VinculosestadoController < Msip::Admin::BasicasController
      before_action :set_vinculoestado, only: [:show, :edit, :update, :destroy]
      load_and_authorize_resource class: Sivel2Gen::Vinculoestado
  
Severity: Major
Found in app/controllers/sivel2_gen/admin/vinculosestado_controller.rb and 2 other locations - About 50 mins to fix
app/controllers/sivel2_gen/admin/antecedentes_controller.rb on lines 3..21
app/controllers/sivel2_gen/admin/contextos_controller.rb on lines 2..20

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

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

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

            if (!pCategoria.nil? && !pCategoria.empty? && pCategoria != [""])
              where1 += (where1 != '' ? ' AND ' : '') + 
                "(categoria.id IN ('" + pCategoria.join("', '") + "'))"
            else 
              where1 += (where1 != '' ? ' AND ' : '') + 
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 45 mins to fix
lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb on lines 190..196

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

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 Admin
    class EscolaridadesController < Msip::Admin::BasicasController
      before_action :set_escolaridad, only: [:show, :edit, :update, :destroy]
      load_and_authorize_resource class: Sivel2Gen::Escolaridad
  
Severity: Minor
Found in app/controllers/sivel2_gen/admin/escolaridades_controller.rb and 1 other location - About 45 mins to fix
app/controllers/sivel2_gen/admin/sectoressociales_controller.rb on lines 2..20

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

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 Admin
    class SectoressocialesController < Msip::Admin::BasicasController
      before_action :set_sectorsocial, only: [:show, :edit, :update, :destroy]
      load_and_authorize_resource class: Sivel2Gen::Sectorsocial
  
Severity: Minor
Found in app/controllers/sivel2_gen/admin/sectoressociales_controller.rb and 1 other location - About 45 mins to fix
app/controllers/sivel2_gen/admin/escolaridades_controller.rb on lines 2..20

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

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

                      actocolectivo = Sivel2Gen::Actocolectivo.new(
                        presponsable_id: presp,
                        categoria_id: cat,
                        grupoper_id: vicc,
                      )
lib/sivel2_gen/concerns/controllers/actos_controller.rb on lines 75..87

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

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

                      acto = Sivel2Gen::Acto.new(
                        presponsable_id: presp,
                        categoria_id: cat,
                        persona_id: vic,
                      )
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/actos_controller.rb and 1 other location - About 45 mins to fix
lib/sivel2_gen/concerns/controllers/actoscolectivos_controller.rb on lines 55..67

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

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

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

            if (!pCategoria.nil? && !pCategoria.empty? && pCategoria != [""])
              where1 += (where1 != '' ? ' AND ' : '') + 
                "(categoria.id IN ('" + pCategoria.join("', '") + "'))"
            else 
              where1 += (where1 != '' ? ' AND ' : '') + 
lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 825..831

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

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

    def edad_de_fechanac_fecha(anionac, mesnac, dianac, 
                                  anio, mes, dia)
Severity: Minor
Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 45 mins to fix

    Method consulta_final has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def consulta_final(i, que3, tablas3, where3, qc, gb)

      Avoid deeply nested control flow statements.
      Open

                      for (const opc of elem.options) {
                        if(opc.value == val){
                          opc.selected = true;
                        }
                      }
      Severity: Major
      Found in app/javascript/controllers/motor.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for (let i = 0; i < ruta.length; i++) {
                      if (i === ruta.length - 1) {
                        actual[ruta[i]] = value;
                      } else {
                        if (!actual[ruta[i]]) {
        Severity: Major
        Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 45 mins to fix

          Method presponsables_caso_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def presponsables_caso_ids
                      r = ''
                      if self.caso && self.caso.presponsable
                        r = self.caso.presponsable.inject("") { |memo, pr|
                          (memo == '' ? '' : memo + '; ') + pr.id.to_s
          Severity: Minor
          Found in lib/sivel2_gen/concerns/models/victima.rb - About 45 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 ajusta_titulos has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def ajusta_titulos(pFini, pFfin, pTviolencia, pEtiqueta1,
                                       pEtiqueta2, pColormax)
          Severity: Minor
          Found in lib/sivel2_gen/concerns/controllers/mapamun_controller.rb - About 45 mins to fix

            Method personas_procesa_segun has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                      def personas_procesa_segun(que1, tablas1, where1, que3, tablas3, where3)
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix

              Method procesa_filtrosm has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                        def procesa_filtrosm(que1, tablas1, where1, que3, 
                                                tablas3, where3)
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                Method procesa_desagregarpor has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                          def procesa_desagregarpor(que1, tablas1, where1, que3, tablas3, where3)
                Severity: Minor
                Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                  Method procesa_desagregarpor_om has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                            def procesa_desagregarpor_om(que1, tablas1, where1, que3, tablas3, where3)
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                    Method consulta_final has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                              def consulta_final(i, que3, tablas3, where3, qc, gb)
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                      Method personas_segun_tipico has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                def personas_segun_tipico(tabla, nomtabla, que1, que3, tablas3, where3)
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language