pasosdeJesus/sivel2_gen

View on GitHub

Showing 228 of 380 total issues

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

                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 lista has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def lista
                              if params[:tabla]
                                r = nil
                                if (params[:tabla] == "departamento" && params[:pais_id].to_i > 0)
                                  r = Msip::Departamento.where(fechadeshabilitacion: nil,
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

                    Method embeber_mapacalormuncol_svg has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          depid, depcad, titulo, subtitulo, titulorangos, fuente, 
                          cantidadesmun, opciones = {})
                    Severity: Major
                    Found in app/helpers/sivel2_gen/vista_helper.rb - About 1 hr to fix

                      Method graficar_sexo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def graficar_sexo
                                series_gen= []
                                if (@vic_dep.count == 0) || (@vic_categorias.count == 0)
                                  flash.now[:info] = "Uno de los filros se encuentra vacío"
                                else
                      Severity: Minor
                      Found in app/controllers/sivel2_gen/fil23_gen/graficar_apexcharts_controller.rb - About 55 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 sin_identificacion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def sin_identificacion
                                  if nombres == "N" && apellidos == "N"
                                    caso = Sivel2Gen::Victima.where(persona_id: self.id)[0].caso_id
                                    vics = Sivel2Gen::Victima.where(caso_id: caso)
                                    hv = {}
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/models/persona.rb - About 55 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 pestanas_formulariocaso has a Cognitive Complexity of 9 (exceeds 5 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 55 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 remplazar has a Cognitive Complexity of 9 (exceeds 5 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 55 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 poblacion_por_sexo_rango has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def poblacion_por_sexo_rango(caso_id, anio, mes, dia, modelorango, rangoedad, totsexo)
                      Severity: Major
                      Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix

                        Method poblacion_por_rango_sexo has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def poblacion_por_rango_sexo(caso_id, anio, mes, dia, modelorango, 
                                                         rangoedadsexo, totsexo)
                        Severity: Major
                        Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix

                          Method importar_relato has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                    def self.importar_relato(doc, menserror, sintaxis_errores, mensexito, ids_importados,
                                                             usuario_id, formato_sexo)
                          Severity: Major
                          Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 50 mins to fix

                            Method presponsables_caso_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                      def presponsables_caso_ids
                                        r = ''
                                        if self.caso && self.caso.presponsable
                                          r = self.caso.presponsable.inject("") { |memo, pr|
                                            (memo == '' ? '' : memo + '; ') + pr.id.to_s
                            Severity: Minor
                            Found in lib/sivel2_gen/concerns/models/victima.rb - About 45 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