pasosdeJesus/sivel2_gen

View on GitHub

Showing 241 of 410 total issues

Function cambiarficha has 126 lines of code (exceeds 25 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: Major
Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 5 hrs to fix

    Method index has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

              def index
                if !Rails.configuration.x.sivel2_consulta_web_publica
                  authorize! :index, Sivel2Gen::Caso
                end
                begin
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 4 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 108 lines of code (exceeds 25 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: Major
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 4 hrs to fix

      Method sivel2_gen_victima_presenta has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

                def sivel2_gen_victima_presenta(atr)
                  case atr.to_s
                  when 'fecha_caso'
                    self.caso ? self.caso.fecha : ''
                  when 'nombre'
      Severity: Minor
      Found in lib/sivel2_gen/concerns/models/victima.rb - About 4 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 create_sivel2_gen has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

                def create_sivel2_gen
                  @merr = "" # Colchon para errores
                  if params[:caso][:id].nil?
                    @merr = 'Falta identificacion del caso' 
                    render inline: @merr, status: :unprocessable_entity
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/actoscolectivos_controller.rb - About 4 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 graficar_conteo_controller.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Sivel2Gen
        module Concerns
          module Controllers
            module GraficarConteoController
              extend ActiveSupport::Concern
      Severity: Minor
      Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 4 hrs to fix

        File ability.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Sivel2Gen
          # Permisos
          class Ability < Msip::Ability
            include CanCan::Ability
        
        
        Severity: Minor
        Found in app/models/sivel2_gen/ability.rb - About 3 hrs to fix

          File conscaso.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Sivel2Gen
            module Concerns
              module Models
                module Conscaso 
                  extend ActiveSupport::Concern
          Severity: Minor
          Found in lib/sivel2_gen/concerns/models/conscaso.rb - About 3 hrs to fix

            Function presentarMapaOsm has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              presentarMapaOsm(usuario_autenticado) {
                var usuario_aut_global = usuario_autenticado;
                // Borrar clase container y ocultar pie de página
                document.querySelector('.navbar').classList.add('navbarosm');
                document.querySelector('.card-body').classList.add('cardbodyosm');
            Severity: Major
            Found in app/javascript/controllers/mapaosm_controller.js - About 3 hrs to fix

              Function actualizarEdad has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                actualizarEdad(event){
                  let anio = parseInt(this.anionacTarget.value);
                  let mes = parseInt(this.mesnacTarget.value) - 1;
                  let dia = parseInt(this.dianacTarget.value);
              
              
              Severity: Minor
              Found in app/javascript/controllers/edad_controller.js - About 3 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 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                        def victimizaciones
                          authorize! :contar, Sivel2Gen::Caso
              
                          # Filtros
                          pFini = escapar_param(params, [:filtro, 'fechaini'])
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/mapamun_controller.rb - About 3 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_co has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                            def recorrer_observaciones_co(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/combatiente.rb - About 3 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                        def importa(datosent, datossal, menserror, opciones = {})
                          pais = Msip::Pais.
                            where('nombre ILIKE ?', datosent['pais']).ids[0]
                          self.pais_id = pais || Msip.paisomision 
                          dep = Msip::Departamento.
              Severity: Minor
              Found in lib/sivel2_gen/concerns/models/ubicacion.rb - About 3 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 motor.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import Sivel2Gen__AutocompletaAjaxColectivas from "./AutocompletaAjaxColectivas"
              window.Sivel2Gen__AutocompletaAjaxColectivas = Sivel2Gen__AutocompletaAjaxColectivas 
              
              import Sivel2Gen__AutocompletaAjaxFamiliares from "./AutocompletaAjaxFamiliares"
              window.Sivel2Gen__AutocompletaAjaxFamiliares = Sivel2Gen__AutocompletaAjaxFamiliares 
              Severity: Minor
              Found in app/javascript/controllers/motor.js - About 3 hrs to fix

                Function actualizarEdad has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  actualizarEdad(event){
                    let anio = parseInt(this.anionacTarget.value);
                    let mes = parseInt(this.mesnacTarget.value) - 1;
                    let dia = parseInt(this.dianacTarget.value);
                
                
                Severity: Major
                Found in app/javascript/controllers/edad_controller.js - About 3 hrs to fix

                  Method presenta_mas_index has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def presenta_mas_index(formato)
                              formato.csv {
                                authorize! :exportaCSV, Sivel2Gen::Caso
                                atributos = %w{caso_id fecha ubicaciones victimas presponsables tipificacion memo}
                                r = CSV.generate(headers: true) do |csv|
                  Severity: Major
                  Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 3 hrs to fix

                    Method presenta_index has 79 lines of code (exceeds 25 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: Major
                    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 3 hrs to fix

                      Method personas_arma_filtros_sivel2_gen has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def personas_arma_filtros_sivel2_gen
                                  caniosnac = Msip::Persona.where('anionac IS NOT NULL').
                                    pluck('distinct anionac').sort
                      
                                  cmesescasos = Sivel2Gen::Caso.all.pluck('distinct fecha').
                      Severity: Major
                      Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 3 hrs to fix

                        Method personas_procesa_filtros_sivel2_gen has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def personas_procesa_filtros_sivel2_gen(que1, tablas1, where1, que3, 
                                                                          tablas3, where3)
                                    @filtrosegun.each do |e, r|
                                      if (params[:filtro] && params[:filtro][r[:nomfiltro]] && 
                                          params[:filtro][r[:nomfiltro]] != '') 
                        Severity: Minor
                        Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 3 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 ubicacion_caso has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def ubicacion_caso
                                    r = ''
                                    if self.caso && self.caso.ubicacionprincipal
                                      if self.caso.ubicacionprincipal.pais_id == 170
                                        r += self.caso.ubicacionprincipal.departamento ?
                        Severity: Minor
                        Found in lib/sivel2_gen/concerns/models/victima.rb - About 3 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

                        Severity
                        Category
                        Status
                        Source
                        Language