pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

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

          def vista_geo(que3, tablas3, where3)
            if (@pDepartamento == "1") 
              que3 << ["departamento_nombre", "Departamento"]
            end
            if (@pMunicipio== "1") 
lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 295..324

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

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

  module Admin
    class ProfesionesController < Msip::Admin::BasicasController
      before_action :set_profesion, only: [:show, :edit, :update, :destroy]
      load_and_authorize_resource class: Sivel2Gen::Profesion
  
Severity: Major
Found in app/controllers/sivel2_gen/admin/profesiones_controller.rb and 4 other locations - About 40 mins to fix
app/controllers/sivel2_gen/admin/actividadoficios_controller.rb on lines 2..16
app/controllers/sivel2_gen/admin/filiaciones_controller.rb on lines 2..16
app/controllers/sivel2_gen/admin/fronteras_controller.rb on lines 2..16
app/controllers/sivel2_gen/admin/organizaciones_controller.rb on lines 2..16

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

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

Consider simplifying this complex logical expression.
Open

        if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 && 
            dianac > dia)
          na -= 1
        end
Severity: Major
Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
              cr = crt
              cv = cvt
              ca = cat
            end
    Severity: Major
    Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
                cr = crt
                cv = cvt
                ca = cat
              end
      Severity: Major
      Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

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

                } else {
                  div_fini.style.display = "none"
                  div_ffin.style.display = "none"
                  div_fdep.style.display = "none"
                }
        Severity: Minor
        Found in app/javascript/controllers/motor.js and 1 other location - About 40 mins to fix
        app/javascript/controllers/motor.js on lines 77..81

        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

          module Concerns
            module Models
              module Profesion
                extend ActiveSupport::Concern
        
        
        Severity: Minor
        Found in lib/sivel2_gen/concerns/models/profesion.rb and 1 other location - About 40 mins to fix
        lib/sivel2_gen/concerns/models/sectorsocial.rb on lines 3..18

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

        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

        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

          module Concerns
            module Models
              module Sectorsocial
                extend ActiveSupport::Concern
        
        
        Severity: Minor
        Found in lib/sivel2_gen/concerns/models/sectorsocial.rb and 1 other location - About 40 mins to fix
        lib/sivel2_gen/concerns/models/profesion.rb on lines 3..16

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

        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 (e.target.value.includes('22')) {
                  div_fini.style.display = "block"
                  div_ffin.style.display = "block"
                  div_fdep.style.display = "block"
                } else {
        Severity: Minor
        Found in app/javascript/controllers/motor.js and 1 other location - About 40 mins to fix
        app/javascript/controllers/motor.js on lines 81..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 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/victima.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/caso.rb - About 35 mins to fix

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

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

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

            Severity
            Category
            Status
            Source
            Language