pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

Method importa has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

          def importa(datosent, datossal, menserror, opciones = {})
            ## Verifica que sí es un presunto responsable
            pres = Sivel2Gen::Presponsable.
              where('upper(nombre COLLATE es_co_utf_8)=upper(? COLLATE es_co_utf_8)', datosent['nombre_grupo'])
            unless pres.empty?
Severity: Minor
Found in lib/sivel2_gen/concerns/models/caso_presponsable.rb - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method filtra_por_tviolencia has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

          def filtra_por_tviolencia
            datos = []
            if params[:tviolencia] && Sivel2Gen::Supracategoria.where(
                tviolencia_id: params[:tviolencia]).count > 0

Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/categorias_controller.rb - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method victimizaciones_gen_tabla has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

            pFini, pFfin, pTviolencia, pEtiqueta1, pEtiqueta2,
            pExcluirCateRep, pSegun, pDepartamento, pMunicipio, otro,
            pCategoria, pAgrucol)
Severity: Major
Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

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

          if opciones[:colormax_r].present? && opciones[:colormax_v].present? && 
              opciones[:colormax_a].present?
            crt = opciones[:colormax_r].to_i 
            cvt = opciones[:colormax_v].to_i 
            cat = opciones[:colormax_a].to_i 
    Severity: Major
    Found in app/helpers/sivel2_gen/vista_helper.rb and 1 other location - About 1 hr to fix
    app/helpers/sivel2_gen/vista_helper.rb on lines 326..336

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

    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 opciones[:colormax_r].present? && opciones[:colormax_v].present? && 
              opciones[:colormax_a].present?
            crt = opciones[:colormax_r].to_i 
            cvt = opciones[:colormax_v].to_i 
            cat = opciones[:colormax_a].to_i 
    Severity: Major
    Found in app/helpers/sivel2_gen/vista_helper.rb and 1 other location - About 1 hr to fix
    app/helpers/sivel2_gen/vista_helper.rb on lines 72..82

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function operarElegida has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static operarElegida (eorig, cadpersona, id, otrosop) {
        vic_position = eorig.target.id.split("_")[3]
        fam_position = eorig.target.id.split("_")[9]
        Msip__Motor.arreglarPuntomontaje()
        const cs = id.split(';')
    Severity: Minor
    Found in app/javascript/controllers/AutocompletaAjaxFamiliares.js - About 1 hr to fix

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

                      if r[:metodo_id] == :id
                        ids = r[:coleccion].where(
                          id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.
                          map(&:to_i)
                        ).pluck(:id)
      Severity: Major
      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb and 1 other location - About 1 hr to fix
      lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb on lines 152..161

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

      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 r[:metodo_id] == :id
                        ids = r[:coleccion].where(
                          id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.
                          map(&:to_i)
                        ).pluck(:id)
      lib/sivel2_gen/concerns/controllers/conteos_controller.rb on lines 154..164

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function agregarCasosOsm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        agregarCasosOsm(usuario_autenticado) {
          if (typeof window.formato_fecha === 'undefined') {
            Msip__Mootr.preparaEventosComunes();
          }
          var urlSolicitud = this.armarRutaConsulta('casos.json', usuario_autenticado);
      Severity: Minor
      Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

        Function armarRutaConsulta has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          armarRutaConsulta(rutaSinPuntomontaje, usuarioAutenticado) {
            var ruta = window.puntoMontaje + rutaSinPuntomontaje;
            var desde = document.getElementById('campo-desde').value;
            var hasta = document.getElementById('campo-hasta').value;
            var departamento = document.getElementById('departamento').value;
        Severity: Minor
        Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

          Method nuevo has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def nuevo
                      if params[:caso_id]
                        @grupoper = Msip::Grupoper.new
                        @victimacolectiva = Victimacolectiva.new
                        @grupoper.nombre = 'N'

            Method importa has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def importa(datosent, datossal, menserror, opciones = {})
                        victimascol = datosent[0]
                        d = datosent[1]
                        if d['id_grupo_victima']
                          self.presponsable_id = d['id_presunto_grupo_responsable']
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/actocolectivo.rb - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function obtener_info_victimas has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              obtener_info_victimas(victimas, prresp, caso) {
                var victimasCont = '<div><table>' +
                  '<tr><td>Víctimas:</td><td>';
                for (var cv in victimas) {
                  if (victimas.hasOwnProperty(cv)) {
            Severity: Minor
            Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method consulta has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def consulta
                        authorize! :contar, Sivel2Gen::Caso
            
                        arma_estructuras
            
            
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method departamento_caso has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def departamento_caso
                        r = ''
                        if self.caso && self.caso.ubicacionprincipal
                          if self.caso.ubicacionprincipal.pais_id == Msip.paisomision
                            r += self.caso.ubicacionprincipal.departamento ?
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/victima.rb - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method importa has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                      def importa(datosent, datossal, menserror, opciones = {})
                        victimas = datosent[0]
                        d = datosent[1]
                        if d['id_victima_individual']
                          self.presponsable_id = d['id_presunto_responsable_individual'].to_i
            Severity: Minor
            Found in lib/sivel2_gen/concerns/models/acto.rb - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method filtra_por_tviolencia has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def filtra_por_tviolencia
                        datos = []
                        if params[:tviolencia] && Sivel2Gen::Supracategoria.where(
                            tviolencia_id: params[:tviolencia]).count > 0
            
            
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/categorias_controller.rb - About 1 hr to fix

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

                          if v['sector_condicion']
                            if Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).count == 1
                              self.sectorsocial_id = Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).ids[0]
                            else
                              menserror << "En la tabla básica Sector Social no existe " +
              Severity: Major
              Found in lib/sivel2_gen/concerns/models/victima.rb and 8 other locations - About 1 hr to fix
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 65..76
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 80..91
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 96..107
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 111..122
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 126..137
              lib/sivel2_gen/concerns/models/victima.rb on lines 401..412
              lib/sivel2_gen/concerns/models/victima.rb on lines 431..442
              lib/sivel2_gen/concerns/models/victima.rb on lines 446..457

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

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

                            if v['ocupacion']
                              if Sivel2Gen::Profesion.where('TRIM(nombre)=?', v['ocupacion'].strip).count == 1
                                self.profesion_id = Sivel2Gen::Profesion.where('TRIM(nombre)=?', v['ocupacion'].strip).ids[0]
                              else
                                menserror << "En la tabla básica Profesion no existe " +
              Severity: Major
              Found in lib/sivel2_gen/concerns/models/combatiente.rb and 8 other locations - About 1 hr to fix
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 80..91
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 96..107
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 111..122
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 126..137
              lib/sivel2_gen/concerns/models/victima.rb on lines 401..412
              lib/sivel2_gen/concerns/models/victima.rb on lines 416..427
              lib/sivel2_gen/concerns/models/victima.rb on lines 431..442
              lib/sivel2_gen/concerns/models/victima.rb on lines 446..457

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

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

                            if v['sector_condicion']
                              if Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).count == 1
                                self.sectorsocial_id = Sivel2Gen::Sectorsocial.where('TRIM(nombre)=?', v['sector_condicion'].strip).ids[0]
                              else
                                menserror << "En la tabla Sector social no existe " +
              Severity: Major
              Found in lib/sivel2_gen/concerns/models/combatiente.rb and 8 other locations - About 1 hr to fix
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 65..76
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 80..91
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 111..122
              lib/sivel2_gen/concerns/models/combatiente.rb on lines 126..137
              lib/sivel2_gen/concerns/models/victima.rb on lines 401..412
              lib/sivel2_gen/concerns/models/victima.rb on lines 416..427
              lib/sivel2_gen/concerns/models/victima.rb on lines 431..442
              lib/sivel2_gen/concerns/models/victima.rb on lines 446..457

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

              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