pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  def index
                    c = nil
                    if params[:municipio_id] 
                      idmun = params[:municipio_id].to_i > 0 ?
                        params[:municipio_id].to_i : nil
        Severity: Minor
        Found in lib/msip/concerns/controllers/centrospoblados_controller.rb and 1 other location - About 40 mins to fix
        lib/msip/concerns/controllers/veredas_controller.rb on lines 18..29

        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 38.

        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 2 locations. Consider refactoring.
        Open

                  def index
                    c = nil
                    if params[:municipio_id]
                      idmun = params[:municipio_id].to_i > 0 ? 
                        params[:municipio_id].to_i : nil
        Severity: Minor
        Found in lib/msip/concerns/controllers/veredas_controller.rb and 1 other location - About 40 mins to fix
        lib/msip/concerns/controllers/centrospoblados_controller.rb on lines 16..27

        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 38.

        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

        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

                  Method item_nav_pestaña_bs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def item_nav_pestaña_bs(idit, titulo, elegida = false,
                        clase_boton = "", &bloque)
                  Severity: Minor
                  Found in app/helpers/msip/bootstrap_helper.rb - About 35 mins to fix

                    Function msip_ubicacionpre_expandible_registra has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function msip_ubicacionpre_expandible_registra(iniid, campoubi, root, 
                      fcamdep = null, fcammun = null) {
                    Severity: Minor
                    Found in app/assets/javascripts/msip/ubicacionpre.js - About 35 mins to fix

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

                          def poromision_con2p(params, p1,  p2, s, 
                                                    valorsp = "")
                      Severity: Minor
                      Found in app/helpers/msip/modelo_helper.rb - About 35 mins to fix

                        Method descarga_anexo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def descarga_anexo
                                    if !params[:id].nil?
                                      @anexo = Anexo.find(params[:id].to_i)
                                      ruta = @anexo.adjunto_file_name
                                      if !ruta.nil?
                        Severity: Minor
                        Found in lib/msip/concerns/controllers/anexos_controller.rb - About 35 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 cambiar_convencion_sexo has a Cognitive Complexity of 7 (exceeds 5 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: Minor
                        Found in app/helpers/msip/sql_helper.rb - About 35 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