pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

Method pestanas_formulariocaso has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def pestanas_formulariocaso
            #byebug
            if current_usuario && can?(:solocambiaretiquetas, Sivel2Gen::Caso)
              [
                { titulo: 'Etiquetas', parcial: 'etiquetas'},
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

    Method remplazar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def remplazar
                @grupoper = Msip::Grupoper.find(params[:grupoper_id].to_i)
                @caso = Sivel2Gen::Caso.find(params[:caso_id].to_i)
                @vicol_posicion = params[:vicol_posicion].to_i
                @caso.current_usuario = current_usuario
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/gruposper_controller.rb - About 1 hr to fix

      Function connect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        connect() {
          document.getElementById("capa-cargando").style.display = 'none';
          console.log("Conexion de controlador enviar ficha caso establecida")
          const pestanias = document.querySelectorAll('.fichacambia');
          pestanias.forEach(function(pestania) {
      Severity: Minor
      Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 1 hr to fix

        Function actualizarGruposper has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function actualizarGruposper(s) {
              var sel = s.value;
              var cadena = '';
              var campo = document.querySelectorAll('#victimascolectivas .control-group[style!="display: none;"]');
              campo.each(function(k, v) {
        Severity: Minor
        Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 1 hr to fix

          Method importa has 28 lines of code (exceeds 25 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

            Method sivel2_gen_destroy has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def sivel2_gen_destroy
                        tcaso_id=@caso.id
                        if @caso.id
                          CasoUsuario.where(caso_id: @caso.id).destroy_all
                        end
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

              Method genvic_tabla has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def genvic_tabla(titulo, filas, tittotales, where1)
                          cuerpo = []
                          tot = 0;
                          filas.each do |f|
                            s = 0;
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

                Method fuenteprensa_fecha_y_fuente_unicas has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                          def fuenteprensa_fecha_y_fuente_unicas
                            fuentesprensa = self.caso_fuenteprensa
                            valfp = []
                            fuentesprensa.each do |fp|
                              if fp && fp.fuenteprensa && 
                Severity: Minor
                Found in lib/sivel2_gen/concerns/models/caso.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 cuenta has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                          def cuenta
                            fechasinicial = Sivel2Gen::Caso.all.order(fecha: :asc).pluck(:fecha).uniq
                            fechafinal = params[:fechafin] ? params[:fechafin] : Date.today
                            fechainicial = params[:fechaini] ? params[:fechaini] : 
                              (fechasinicial.count > 0 ? fechasinicial[0] : '2001-01-01')
                Severity: Minor
                Found in lib/sivel2_gen/concerns/controllers/casos_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 guardar_y_editar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                          def guardar_y_editar
                            @caso = Caso.find(params[:id])
                            @caso.assign_attributes(caso_params)
                            @caso.memo = @caso.memo == "" ? " " : @caso.memo
                            if @caso.save
                Severity: Minor
                Found in lib/sivel2_gen/concerns/controllers/casos_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 sivel2_gen_destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                          def sivel2_gen_destroy
                            tcaso_id=@caso.id
                            if @caso.id
                              CasoUsuario.where(caso_id: @caso.id).destroy_all
                            end
                Severity: Minor
                Found in lib/sivel2_gen/concerns/controllers/casos_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 nuevo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

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

                Cognitive Complexity

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

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

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

                Further reading

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

                    def nuevo
                      if params[:caso_id]
                        @combatiente = Combatiente.new
                        @combatiente.nombre = 'N'
                        @combatiente.sexo = Msip::Persona.convencion_sexo[:sexo_masculino].to_s
                Severity: Minor
                Found in app/controllers/sivel2_gen/combatientes_controller.rb - About 1 hr to fix

                  Method vista_geo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def vista_geo(que3, tablas3, where3)
                              if (@pDepartamento == "1") 
                                que3 << ["departamento_nombre", "Departamento"]
                              end
                              if (@pMunicipio== "1") 
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 1 hr to fix

                    Method procesa_filtros_categoria has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def procesa_filtros_categoria(where1)
                                pTviolencia = escapar_param(params, [:filtro, 'tviolencia_id'])
                                @pDesagregarpor = escapar_param(params, [:filtro, 'segun'])
                                pExcluirCateRep = escapar_param(params, [:filtro, 'excluircaterep'])
                                lcat = Sivel2Gen::Categoria.habilitados.pluck(:id)
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 1 hr to fix

                      Function capaInfo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        capaInfo(des, hec, vic) {
                          if (this.constructor.info != undefined) { // si ya tenía información se quita primero
                            this.constructor.info.remove(this.constructor.mapa); 
                          }
                          this.constructor.info.onAdd = function (mapa) {
                      Severity: Minor
                      Found in app/javascript/controllers/mapaosm_controller.js - About 1 hr to fix

                        Method personas_vista_geo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def personas_vista_geo(que3, tablas3, where3)
                                    if (@pDepartamento == "1") 
                                      que3 << ["departamento_nombre", "Departamento"]
                                    end
                                    if (@pMunicipio== "1") 
                        Severity: Minor
                        Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

                          Method remplazar_sivel2_gen has 27 lines of code (exceeds 25 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 1 hr to fix

                            Method calcula_de_depmun has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                      def calcula_de_depmun(departamento_id, municipio_id)
                                        if departamento_id && 
                                            Sivel2Gen::DepartamentoRegion.where(
                                              departamento_id: departamento_id).count > 0
                                          dr = Sivel2Gen::DepartamentoRegion.
                            Severity: Minor
                            Found in lib/sivel2_gen/concerns/models/region.rb - About 1 hr to fix

                              Method nueva has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                        def nueva
                                          if params[:caso_id]
                                            @casoetiqueta = Sivel2Gen::CasoEtiqueta.new
                                            @casoetiqueta.caso_id = params[:caso_id]
                                            @casoetiqueta.etiqueta_id = Msip::Etiqueta.count > 0 ? Msip::Etiqueta.take.id : 0
                              Severity: Minor
                              Found in lib/sivel2_gen/concerns/controllers/caso_etiquetas_controller.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language