pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

Method genvic has 194 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def genvic
            authorize! :contar, Sivel2Gen::Caso

            where1 = '';
            @fechaini = '';
Severity: Major
Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 7 hrs to fix

    Method victimizaciones_individuales has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

          def victimizaciones_individuales
            authorize! :contar, Sivel2Gen::Caso
    
            ## Valores de los filtros
            @vic_fechaini = params[:filtro] ? 

    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 asignar_id_personatrelacion has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

              def asignar_id_personatrelacion(
                params, victima_indice, victima_params, victimas_por_borrar
              )
                if victima_params[:persona_attributes]
                  if victima_params[:persona_attributes][:persona_trelacion1_attributes]
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 7 hrs 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 189 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def importa(datosent, datossal, formato_sexo,
                          menserror, opciones = {})
                if datosent['fecha'].nil?
                  self.fecha = Date.today
                  menserror << "Falta fecha. "
    Severity: Major
    Found in lib/sivel2_gen/concerns/models/caso.rb - About 7 hrs to fix

      Method embeber_mapacalormuncol_svg has 187 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def embeber_mapacalormuncol_svg(
            depid, depcad, titulo, subtitulo, titulorangos, fuente, 
            cantidadesmun, opciones = {})
            # Color más oscuro (para rango4)
            cr = 0
      Severity: Major
      Found in app/helpers/sivel2_gen/vista_helper.rb - About 7 hrs to fix

        Method embeber_mapacalordepcol_svg has 186 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def embeber_mapacalordepcol_svg(titulo, subtitulo, titulorangos, fuente,
                                            cantidadesdep, opciones = {})
              # Color más oscuro (para rango4)
              cr = 0
              cv = 255
        Severity: Major
        Found in app/helpers/sivel2_gen/vista_helper.rb - About 7 hrs to fix

          Method genconsulta_victimizaciones has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
          Open

                    def genconsulta_victimizaciones(
                      pFini, pFfin, pTviolencia, pEtiqueta1, pEtiqueta2, pExcluirCateRep,
                      pSegun, pDepartamento, pMunicipio, pCategoria = nil)
          
                      tcons1 = 'cvt1'
          Severity: Minor
          Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 7 hrs 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 importar_relato has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.importar_relato(doc, menserror, sintaxis_errores, mensexito, ids_importados,
                                             usuario_id, formato_sexo)
                      if !Nokogiri::XML(doc).errors.empty?
                        Nokogiri::XML(doc).errors.each do |error|
                          sintaxis_errores.push(error.message)
          Severity: Minor
          Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 6 hrs 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 recorrer_observaciones_v has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

                      def recorrer_observaciones_v(ele, menserror)
                        case ele[0]
                        when 'filiacion'
                          if Sivel2Gen::Filiacion.where('TRIM(nombre)=?', ele[1].strip).count ==1
                            self.filiacion_id = Sivel2Gen::Filiacion.
          Severity: Minor
          Found in lib/sivel2_gen/concerns/models/victima.rb - About 6 hrs 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

          File mapaosm_controller.js has 423 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Controller } from "@hotwired/stimulus"
          
          import Msip__Motor from "../msip/motor"
          
          
          
          Severity: Minor
          Found in app/javascript/controllers/mapaosm_controller.js - About 6 hrs to fix

            Function cambiarficha has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

              cambiarficha(){
                if(event.target.dataset.enviarFichaCasoTarget == 'actos-pestana'){
                  document.getElementById("capa-cargando").style.display = 'flex';
                  if(this.requiereGuardar()){
                    let casoId = this.idcasoTarget.value
            Severity: Minor
            Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 6 hrs 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_individuales has 151 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def victimizaciones_individuales
                    authorize! :contar, Sivel2Gen::Caso
            
                    ## Valores de los filtros
                    @vic_fechaini = params[:filtro] ? 

              Method presenta_index has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                        def presenta_index
                          # Presentación
                          respond_to do |format|
                            if current_usuario || (Rails.configuration.x.sivel2_consweb_max &&
                                @conscaso.count <= Rails.configuration.x.sivel2_consweb_max.to_i)
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 5 hrs 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

              File vista_helper.rb has 408 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Sivel2Gen
                module VistaHelper
              
                  include Rails.application.routes.url_helpers
              
              
              Severity: Minor
              Found in app/helpers/sivel2_gen/vista_helper.rb - About 5 hrs to fix

                Method initialize_sivel2_gen has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.initialize_sivel2_gen(habilidad, usuario = nil)
                      # Sin autenticación puede consultarse información geográfica
                      habilidad.can :read, [Msip::Pais, Msip::Departamento, Msip::Municipio, Msip::Centropoblado, Msip::Ubicacionpre]
                
                      # Hacer conteos
                Severity: Minor
                Found in app/models/sivel2_gen/ability.rb - About 5 hrs 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 genconsulta_victimizaciones has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def genconsulta_victimizaciones(
                            pFini, pFfin, pTviolencia, pEtiqueta1, pEtiqueta2, pExcluirCateRep,
                            pSegun, pDepartamento, pMunicipio, pCategoria = nil)
                
                            tcons1 = 'cvt1'
                Severity: Major
                Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 5 hrs to fix

                  Method importa has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def importa(datosent, datossal, menserror, opciones = {})
                              v = datosent[1]
                              if v
                                if v['nombre']
                                  self.nombre = v['nombre']
                  Severity: Major
                  Found in lib/sivel2_gen/concerns/models/combatiente.rb - About 5 hrs to fix

                    Method initialize_sivel2_gen has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.initialize_sivel2_gen(habilidad, usuario = nil)
                          # Sin autenticación puede consultarse información geográfica
                          habilidad.can :read, [Msip::Pais, Msip::Departamento, Msip::Municipio, Msip::Centropoblado, Msip::Ubicacionpre]
                    
                          # Hacer conteos
                    Severity: Major
                    Found in app/models/sivel2_gen/ability.rb - About 5 hrs to fix

                      Method importa has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def importa(g, datossal, menserror, opciones = {})
                                  #Se verifica que el grupo no sea un presunto responsable
                                  gp = Msip::Grupoper.new
                                  gp.nombre = g['nombre_grupo']
                                  gp.save!
                      Severity: Major
                      Found in lib/sivel2_gen/concerns/models/victimacolectiva.rb - About 5 hrs to fix

                        Method update_gen has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def update_gen
                                    respond_to do |format|
                        
                                      if (caso_params[:caso_ubicacionpre_attributes])
                                        # Usa ubicacionepre existente o agrega si hace falta
                        Severity: Major
                        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language