pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

File sql_helper.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msip
  module SqlHelper
    # Pone cotejación dada a una columna tipo varchar (longitud long)
    # Si la cotejación es nil o "" quita la posible cotejación
    # que la columna tuviera
Severity: Minor
Found in app/helpers/msip/sql_helper.rb - About 3 hrs to fix

    Method index_msip has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def index_msip(c = nil)
                if !c.nil?
                  if c.class.to_s.end_with?("ActiveRecord_Relation")
                    if clase.constantize.to_s != c.klass.to_s
                      Rails.logger.debug do
    Severity: Major
    Found in lib/msip/concerns/controllers/modelos_controller.rb - About 3 hrs to fix

      Method fecha_local_colombia_estandar has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def fecha_local_colombia_estandar(f, menserror = nil)
            # Date.strptime(f, '%d-%M-%Y') no ha funcionado,
            # %b debe ser en ingles
            # rails-i18n I18n.localize con %b produce mes en minuscula
            unless f
      Severity: Minor
      Found in app/helpers/msip/formato_fecha_helper.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 genera_asociabasica has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def genera_asociabasica
            if ENV["DISABLE_SPRING"].to_i != 1
              # http://makandracards.com/makandra/24525-disabling-spring-when-debugging
              Rails.logger.debug("Ejecutar con DISABLE_SPRING=1")
              return
      Severity: Major
      Found in lib/generators/msip/asociabasica_generator.rb - About 3 hrs to fix

        Method update_gen has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def update_gen(registro = nil)
                    @registro = if registro
                      registro
                    else
                      clase.constantize.find(params[:id])
        Severity: Major
        Found in lib/msip/concerns/controllers/modelos_controller.rb - About 3 hrs to fix

          Similar blocks of code found in 3 locations. 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 and 2 other locations - About 3 hrs to fix
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 194..247
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 314..367

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 115.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. 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 and 2 other locations - About 3 hrs to fix
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 314..367
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 372..425

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 115.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. 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 and 2 other locations - About 3 hrs to fix
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 194..247
          lib/msip/concerns/controllers/ubicacionespre_controller.rb on lines 372..425

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 115.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method vfechanac has a Cognitive Complexity of 22 (exceeds 5 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 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 copiar_asociaciones has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                def copiar_asociaciones(foranea_id, excepciones)
                  self.class.reflect_on_all_associations.each do |ua|
                    if ((ua.macro == :has_many && !ua.options[:through]) || 
                        ua.macro == :has_and_belongs_to_many ) &&
                       !excepciones.include?(ua.name)
          Severity: Minor
          Found in app/models/msip/modelo.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 modelo_helper.rb has 295 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Msip
            module ModeloHelper
              include ActionView::Helpers::TextHelper
          
              MESES = [
          Severity: Minor
          Found in app/helpers/msip/modelo_helper.rb - About 3 hrs to fix

            Method escapar_param has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def escapar_param(params, p, poromision = "")
                  if p.is_a?(String) || p.is_a?(Symbol)
                    params[p] ? escapar(params[p]) : ""
                  elsif p.is_a?(Array) && p.length == 1
                    params[p[0]] ? espacar_cadena(params[p[0]]) : ""
            Severity: Minor
            Found in app/helpers/msip/sql_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 create_gen has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                      def create_gen(registro = nil)
                        c2 = clase.demodulize.underscore
                        if registro
                          @registro = registro
                        else
            Severity: Minor
            Found in lib/msip/concerns/controllers/modelos_controller.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

            File personas_controller.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Msip
              module Concerns
                module Controllers
                  module PersonasController
                    extend ActiveSupport::Concern
            Severity: Minor
            Found in lib/msip/concerns/controllers/personas_controller.rb - About 2 hrs to fix

              Method fecha_local_colombia_estandar has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def fecha_local_colombia_estandar(f, menserror = nil)
                    # Date.strptime(f, '%d-%M-%Y') no ha funcionado,
                    # %b debe ser en ingles
                    # rails-i18n I18n.localize con %b produce mes en minuscula
                    unless f
              Severity: Major
              Found in app/helpers/msip/formato_fecha_helper.rb - About 2 hrs to fix

                Method destroy_gen has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def destroy_gen(mens = "", verifica_tablas_union = true)
                            @registro = clase.constantize.find(params[:id])
                            if @registro.respond_to?("current_usuario=")
                              @registro.current_usuario = current_usuario
                            end
                Severity: Major
                Found in lib/msip/concerns/controllers/modelos_controller.rb - About 2 hrs to fix

                  Function ponerTema has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static ponerTema(root, tema) {
                      console.log("entro a msip_ pone_tema")
                      document.querySelectorAll('.table-striped>tbody>tr:nth-child(odd)').forEach((element) => {
                        element.style.backgroundColor = tema.fondo_lista;
                      });
                  Severity: Major
                  Found in app/javascript/controllers/motor.js - About 2 hrs to fix

                    Method presenta_gen_msip has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def presenta_gen_msip(atr)
                            clf = self.class.clase_llave_foranea(atr)
                            if self.class.columns_hash && self.class.columns_hash[atr.to_s] &&
                                self.class.columns_hash[atr.to_s].type == :boolean
                              if self[atr.to_s]
                    Severity: Major
                    Found in app/models/msip/modelo.rb - About 2 hrs to fix

                      Method barra_navegacion_prosidebar has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def barra_navegacion_prosidebar(opciones, &bloque)
                            fondo = "".html_safe
                            if opciones[:imagen_barra_lateral]
                              fondo = content_tag(
                                :div, class: "image-wrapper"
                      Severity: Major
                      Found in app/helpers/msip/bootstrap_helper.rb - About 2 hrs to fix

                        Method create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def create
                                    @respaldo7z = Respaldo7z.new(respaldo7z_params)
                                    respond_to do |format|
                                      if @respaldo7z.valid?
                                        Rake::Task["msip:vuelca"].reenable
                        Severity: Major
                        Found in lib/msip/concerns/controllers/respaldo7z_controller.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language