pasosdeJesus/msip

View on GitHub

Showing 214 of 272 total issues

File motor.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open


export default class Msip__Motor {
  /* 
   * Librería de funciones comunes.
   * Aunque no es un controlador lo dejamos dentro del directorio
Severity: Minor
Found in app/javascript/controllers/motor.js - About 2 hrs to fix

    Function msip_ubicacionpre_expandible_registra has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function msip_ubicacionpre_expandible_registra(iniid, campoubi, root, 
      fcamdep = null, fcammun = null) {
      msip_arregla_puntomontaje(root)
    
      // Buscador en campo lugar
    Severity: Major
    Found in app/assets/javascripts/msip/ubicacionpre.js - About 2 hrs to fix

      Method filtrar has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def filtrar(reg, params_filtro)
                  # Control para fecha podría no estar localizado aunque
                  # campos por presentar si
                  latr1 = atributos_index.map do |a|
                    if a.to_s.end_with?("_localizada")
      Severity: Major
      Found in lib/msip/concerns/controllers/modelos_controller.rb - About 2 hrs to fix

        Method validar_conjunto_municipios_biyeccion has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def validar_conjunto_municipios_biyeccion(validaciones)
                    if Msip::Municipio.all.count != Msip::Ubicacionpre.
                        where(lugar: nil).where.not(municipio_id: nil).
                        where(centropoblado_id: nil).where(vereda_id: nil).count
                      validaciones << {
        Severity: Major
        Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

          Method cambiar_convencion_sexo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def cambiar_convencion_sexo(convencion_final)
                unless Msip::Persona::CONVENCIONES_SEXO.keys.include?(convencion_final)
                  Rails.logger.debug { "Conveción desconocida: #{convecion_final}" }
                  exit(1)
                end
          Severity: Major
          Found in app/helpers/msip/sql_helper.rb - About 2 hrs to fix

            File formato_fecha_helper.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Msip
              module FormatoFechaHelper
                MESES = [
                  "",
                  "Enero",
            Severity: Minor
            Found in app/helpers/msip/formato_fecha_helper.rb - About 2 hrs to fix

              Method create_gen has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def create_gen(registro = nil)
                          c2 = clase.demodulize.underscore
                          if registro
                            @registro = registro
                          else
              Severity: Major
              Found in lib/msip/concerns/controllers/modelos_controller.rb - About 2 hrs to fix

                Method fecha_ddMyyyy has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def fecha_ddMyyyy(*fields)
                        fields.each do |f|
                          define_method("#{f}_ddMyyyy") do
                            val = read_attribute(f)
                            unless val
                Severity: Major
                Found in lib/ext/ActiveRecord/base.rb - About 2 hrs to fix

                  File modelo.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Msip
                    module Modelo
                      extend ActiveSupport::Concern
                      include Msip::Localizacion
                  
                  
                  Severity: Minor
                  Found in app/models/msip/modelo.rb - About 2 hrs to fix

                    Method opciones_tabla_basica has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def opciones_tabla_basica(clase, f, campo)
                          col1 = clase.all
                          if col1.respond_to?(:habilitados)
                            col1 = col1.habilitados
                          end
                    Severity: Minor
                    Found in app/helpers/msip/modelo_helper.rb - About 2 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 item_acordeon_bs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def item_acordeon_bs(
                          acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
                        )
                          opciones = opciones_ps.stringify_keys
                          content_tag(
                    Severity: Major
                    Found in app/helpers/msip/bootstrap_helper.rb - About 2 hrs to fix

                      Method validar_conjunto_departamentos_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def validar_conjunto_departamentos_biyeccion(validaciones)
                                  if Msip::Departamento.all.count != Msip::Ubicacionpre.
                                      where(lugar: nil).where.not(departamento_id: nil).
                                      where(municipio_id: nil).count
                                    validaciones << {
                      Severity: Major
                      Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

                        Method validar_conjunto_veredas_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def validar_conjunto_veredas_biyeccion(validaciones)
                                    if Msip::Vereda.all.count != Msip::Ubicacionpre.
                                        where(lugar: nil).where.not(vereda_id: nil).
                                        where(centropoblado_id: nil).count
                                      validaciones << {
                        Severity: Major
                        Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

                          Method validar_conjunto_centrospoblados_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def validar_conjunto_centrospoblados_biyeccion(validaciones)
                                      if Msip::Centropoblado.all.count != Msip::Ubicacionpre.
                                          where(lugar: nil).where.not(centropoblado_id: nil).
                                          where(vereda_id: nil).count
                                        validaciones << {
                          Severity: Major
                          Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

                            Method despliega_abajo_dk has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def despliega_abajo_dk(opcionmenu, url, opciones = {}, &bloque)
                                  copiaop = opciones
                                  opab = opcionmenu.gsub(" ", "_")
                                  maticon = "home"
                                  if opciones[:maticon]
                            Severity: Minor
                            Found in app/helpers/msip/bootstrap_helper.rb - About 1 hr to fix

                              Method filtra_contenido_params has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                        def filtra_contenido_params
                                          if !params || !params[:ubicacionpre] || 
                                              !params[:ubicacionpre][:lugar] ||
                                              !params[:ubicacionpre][:lugar].strip == '' ||
                                              !params[:ubicacionpre][:pais_id] ||
                              Severity: Minor
                              Found in lib/msip/concerns/controllers/ubicacionespre_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 validar_conjunto_paises_biyeccion has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                        def validar_conjunto_paises_biyeccion(validaciones)
                                          if Msip::Pais.all.count != Msip::Ubicacionpre.where(lugar: nil).
                                              where(departamento_id: nil).count
                                            validaciones << {
                                              titulo: "Diferencia en paises y ubicacionespre dpa de paises",
                              Severity: Minor
                              Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 1 hr to fix

                                Method initialize_msip has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def initialize_msip(usuario = nil)
                                      # El primer argumento para can es la acción a la que se da permiso,
                                      # el segundo es el recurso sobre el que puede realizar la acción,
                                      # el tercero opcional es un diccionario de condiciones para filtrar
                                      # más (e.g :publicado => true).
                                Severity: Minor
                                Found in app/models/msip/ability.rb - About 1 hr to fix

                                  Function enviarAutomaticoFormulario has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    static enviarAutomaticoFormulario(f, metodo = 'GET', tipo = 'script', alertaerror = true, vcommit = 'Enviar', agenviarautom = true) {
                                      const root = window;
                                      const t = Date.now();
                                      let d = -1;
                                      if (root.msip_enviarautomatico_t) {
                                  Severity: Minor
                                  Found in app/javascript/controllers/motor.js - About 1 hr to fix

                                    Method barra_navegacion has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def barra_navegacion(opciones, &bloque)
                                          r = content_tag(
                                            :nav,
                                            class: "navbar navbar-expand-lg navbar-light bg-light",
                                          ) do
                                    Severity: Minor
                                    Found in app/helpers/msip/bootstrap_helper.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language