pasosdeJesus/msip

View on GitHub

Showing 214 of 272 total issues

Avoid deeply nested control flow statements.
Open

          if n[p[i]]
            n = n[p[i]]
          else
            return ""
          end
Severity: Major
Found in app/helpers/msip/sql_helper.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if r.respond_to?(:presenta_nombre)
                  r.presenta_nombre
                else
                  r.id.to_s
                end
    Severity: Major
    Found in app/models/msip/modelo.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

              elsif atr == "fechacreacion"
                created_at
              elsif atr == "fechacreacion_localizada"
                Msip::FormatoFechaHelper.fecha_estandar_local(created_at)
              elsif atr == "fechaactualizacion"
      Severity: Major
      Found in app/models/msip/modelo.rb - About 45 mins to fix

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

            def formato_ubicacion_partes(pais_id, departamento_id, municipio_id,
              centropoblado_id, con_centropoblado, con_pais)
              r = ""
              if pais_id.nil? || Msip::Pais.where(id: pais_id).count != 1
                return r
        Severity: Minor
        Found in app/helpers/msip/ubicacion_helper.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

        Avoid deeply nested control flow statements.
        Open

                      if(alertaerror && xhr.status !== 0 && xhr.responseText !== ''){
                        alert('Error: el servicio respondió: ' + xhr.status + xhr.responseText);
                      }
        Severity: Major
        Found in app/javascript/controllers/motor.js - About 45 mins to fix

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

              def rehabilita_centropoblado(
                id, municipio_id, cplocal_cod, nombre, observacion, fechacreacion
              )
          
                # byebug
          Severity: Minor
          Found in app/helpers/msip/sql_helper.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

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

                    def verificarutas
                      em = ""
                      unless File.directory?(Msip.ruta_anexos)
                        em += "No existe ruta de anexos '#{Msip.ruta_anexos}'. "
                      end
          Severity: Minor
          Found in lib/msip/concerns/controllers/hogar_controller.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

          Method item_acordeon_bs has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
          Severity: Minor
          Found in app/helpers/msip/bootstrap_helper.rb - About 45 mins to fix

            Method caja_de_verificacion_bs has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def caja_de_verificacion_bs(idit, clase_div, valor, at_nombre,
                  etiqueta, opciones = {})
            Severity: Minor
            Found in app/helpers/msip/bootstrap_helper.rb - About 45 mins to fix

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

                        def self.agregar_actualizar(
                          request, indparam1, indparam2, usuario_id, params,
                          modelo, registro_id
                        )
                          # Se intentó implementar a nivel de modelo con
              Severity: Minor
              Found in lib/msip/concerns/models/bitacora.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

              Method rehabilita_centropoblado has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    id, municipio_id, cplocal_cod, nombre, observacion, fechacreacion
              Severity: Minor
              Found in app/helpers/msip/sql_helper.rb - About 45 mins to fix

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

                      def self.asociacion_llave_foranea(atr)
                        aso = reflect_on_all_associations
                        bel = aso.select { |a| a.macro == :belongs_to }
                        fk = bel.map do |e|
                          e.foreign_key.to_s
                Severity: Minor
                Found in app/models/msip/modelo.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

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

                          def mostrar_portada
                            if !params[:id].nil?
                              @anexo = Anexo.find(params[:id].to_i)
                              ruta = @anexo.adjunto_file_name
                              # ls = %x(ls -l #{Msip.ruta_anexos})
                Severity: Minor
                Found in lib/msip/concerns/controllers/anexos_controller.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

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

                          def new_gen
                            if cannot?(:new, clase.constantize)
                              # Supone alias por omision de https://github.com/CanCanCommunity/cancancan/blob/develop/lib/cancan/ability/actions.rb
                              authorize!(:create, clase.constantize)
                            end
                Severity: Minor
                Found in lib/msip/concerns/controllers/modelos_controller.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

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

                      def flotante_localizado(*fields)
                        fields.each do |f|
                          define_method("#{f}_localizado") do
                            val = if attribute_method?(f)
                              read_attribute(f)
                Severity: Minor
                Found in lib/ext/ActiveRecord/base.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

                Consider simplifying this complex logical expression.
                Open

                      if !f || (f.class != String && f.class != Date &&
                          f.class != ActiveSupport::TimeWithZone) ||
                          (f.class == String && f == "")
                        return nil
                      end
                Severity: Major
                Found in app/helpers/msip/formato_fecha_helper.rb - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 &&
                              dianac > dia)
                            na -= 1
                          end
                  Severity: Major
                  Found in app/helpers/msip/edad_sexo_helper.rb - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if !params || !params[:ubicacionpre] || 
                                    !params[:ubicacionpre][:lugar] ||
                                    !params[:ubicacionpre][:lugar].strip == '' ||
                                    !params[:ubicacionpre][:pais_id] ||
                                    Msip::Pais.where(id: params[:ubicacionpre][:pais_id]).count != 1
                    Severity: Major
                    Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 40 mins to fix

                      Method ampliar_where has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def ampliar_where(w, n, v, opcmp = "=", con = "AND")
                      Severity: Minor
                      Found in app/helpers/msip/sql_helper.rb - About 35 mins to fix

                        Method ampliar_where_sinap has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def ampliar_where_sinap(w, n, v, opcmp = "=", con = "AND")
                        Severity: Minor
                        Found in app/helpers/msip/sql_helper.rb - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language