pasosdeJesus/msip

View on GitHub

Showing 214 of 272 total issues

Method atributos_index has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def atributos_index
            [
              :id,
              :nombre,
              :fondo,
Severity: Minor
Found in lib/msip/concerns/controllers/temas_controller.rb - About 1 hr to fix

    Method presenta_nombre has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

              def presenta_nombre(opciones = {})
                sep = ""
                r = ""
                if opciones[:sin_pais].nil? && pais
                  r = pais.nombre
    Severity: Minor
    Found in lib/msip/concerns/models/ubicacion.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

    Function remplazarOpcionesSelect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      static remplazarOpcionesSelect(
        idElemento, nuevasop, usatomselect = false, cid = 'id',
        cetiqueta = 'nombre', opvacia = false
      ) {
        let elemento = document.getElementById(idElemento)
    Severity: Minor
    Found in app/javascript/controllers/motor.js - 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

    Function partirFechaLocalizada has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      static partirFechaLocalizada(fechaLocalizada, formato) {
        let anio = 1900
        let dia = 15
        let mes = 6
        if (formato == 'dd/M/yyyy' || formato == 'dd-M-yyyy') {
    Severity: Minor
    Found in app/javascript/controllers/motor.js - 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 reconoce_adivinando_locale has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def reconoce_adivinando_locale(f, menserror = nil)
          if !f || (f.class != String && f.class != Date) ||
              (f.class == String && f == "")
            return nil
          end
    Severity: Minor
    Found in app/helpers/msip/formato_fecha_helper.rb - About 1 hr to fix

      Function ponerTemaUsuarioAjax has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static async ponerTemaUsuarioAjax(){
          var root = window
          var ruta = 'temausuario'
          var datos = {}
          var t = Date.now();
      Severity: Minor
      Found in app/javascript/controllers/motor.js - About 1 hr to fix

        Method asegura_varambiente_bd has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def asegura_varambiente_bd
              # Toma ideas de https://github.com/opdemand/puppet-modules/blob/master/rails/files/databases.rake
              abcs = ActiveRecord::Base.configurations
              confbd = abcs.configurations.select { |c| c.env_name == Rails.env }.first
        
        
        Severity: Minor
        Found in app/helpers/msip/tareasrake_helper.rb - About 1 hr to fix

          Method vfechanac has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def vfechanac
                      anioactual = Time.now.strftime("%Y").to_i
                      if anionac && anionac > anioactual
                        errors.add(:anionac, "Año debe ser menor al actual")
                      end
          Severity: Minor
          Found in lib/msip/concerns/models/persona.rb - About 1 hr to fix

            Method temausuario has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def temausuario
                        t = ::Msip::TemasHelper.tema_usuario(defined?(current_usuario) ? current_usuario : nil)
                        render(
                          json: {
                            fondo: t.fondo,
            Severity: Minor
            Found in lib/msip/concerns/controllers/temas_controller.rb - About 1 hr to fix

              Method filtra_contenido_params has 27 lines of code (exceeds 25 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

                Method solicitud has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def solicitud
                    unless ENV["SMTP_MAQ"]
                      Rails.logger.debug("No esta definida variable de ambiente SMTP_MAQ")
                      exit(1)
                    end
                Severity: Minor
                Found in app/mailers/solicitud_mailer.rb - About 1 hr to fix

                  Method modelo_path has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def modelo_path(o, posfijo_path = true)
                        if o.nil?
                          return main_app.root_path
                        end
                  
                  
                  Severity: Minor
                  Found in app/helpers/msip/modelo_helper.rb - About 1 hr to fix

                    Method anuncios_bootstrap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def anuncios_bootstrap
                          r = "".dup
                          flash.each do |tipo, mensaje|
                            tal = case tipo.to_sym
                            when :success, :notice
                    Severity: Minor
                    Found in app/helpers/msip/bootstrap_helper.rb - About 1 hr to fix

                      Method genera_modelo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def genera_modelo
                            template(
                              "tablabasica.rb.erb",
                              "app/models/#{nom_arch}.rb",
                            )
                      Severity: Minor
                      Found in lib/generators/msip/tablabasica_generator.rb - About 1 hr to fix

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

                                  def self.a(ip, usuario_id, url, params,
                                    modelo, modelo_id, operacion, detalle_json = "{}")
                        Severity: Major
                        Found in lib/msip/concerns/models/bitacora.rb - About 1 hr to fix

                          Function msip_ubicacionpre_expandible_autocompleta_lugar has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function msip_ubicacionpre_expandible_autocompleta_lugar(centropoblado_id, tsit, lug, sit, lat, lon, ubipre, root){
                          Severity: Major
                          Found in app/assets/javascripts/msip/ubicacionpre.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        elsif dianac && mesnac && (mesnac == 4 || mesnac == 6 ||
                                                                    mesnac == 9 || mesnac == 11) &&
                                            dianac > 30
                                          errors.add(:dianac, "Dia debe ser menor o igual a 30")
                                        elsif dianac && dianac > 31
                            Severity: Major
                            Found in lib/msip/concerns/models/persona.rb - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                            regjson = if params &&
                                                ((params[:presenta_nombre] &&
                                                  params[:presenta_nombre] == "1") ||
                                                 (params[:filtro] && params[:filtro][:presenta_nombre] &&
                                                  params[:filtro][:presenta_nombre] == "1")) && @registros
                              Severity: Major
                              Found in lib/msip/concerns/controllers/modelos_controller.rb - About 1 hr to fix

                                Function cambiar_pais has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  cambiar_pais(e) {
                                    var purl = Msip__Motor.arreglarPuntoMontaje()
                                
                                    console.log("departamento ahora es", this.departamentoTarget.value)
                                    let url = purl + '/admin/departamentos.json?pais_id=' + e.target.value
                                Severity: Minor
                                Found in app/javascript/controllers/geodep_controller.js - 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 modelos_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def modelos_path(o, posfijo_path = true)
                                      if o.nil?
                                        return "#"
                                      end
                                
                                
                                Severity: Minor
                                Found in app/helpers/msip/modelo_helper.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

                                Severity
                                Category
                                Status
                                Source
                                Language