pasosdeJesus/sivel2_gen

View on GitHub

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

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

                            window.Rails.ajax({
                              type: 'GET',
                              url: a,
                              data: d,
                              success: (resp, estado, xhr) => {
                        Severity: Major
                        Found in app/javascript/controllers/AutocompletaAjaxVictimas.js and 2 other locations - About 5 hrs to fix
                        app/javascript/controllers/AutocompletaAjaxColectivas.js on lines 26..40
                        app/javascript/controllers/AutocompletaAjaxFamiliares.js on lines 34..47

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

                        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