pasosdeJesus/heb412_gen

View on GitHub

Showing 73 of 73 total issues

Method llena_plantilla_multiple_importadatos has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

          def self.llena_plantilla_multiple_importadatos(
            plantillahcm, controlador, modelo, narchent, ulteditor_id
          )

            puts "self.llena_plantilla. ulteditor_id=#{ulteditor_id}"
Severity: Minor
Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 1 day 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 plantillahcm_controller.rb has 457 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Heb412Gen
  module Concerns
    module Controllers
      module PlantillahcmController
        extend ActiveSupport::Concern
Severity: Minor
Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 7 hrs to fix

    Method llena_plantilla_multiple_importadatos has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def self.llena_plantilla_multiple_importadatos(
                plantillahcm, controlador, modelo, narchent, ulteditor_id
              )
    
                puts "self.llena_plantilla. ulteditor_id=#{ulteditor_id}"
    Severity: Major
    Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 4 hrs to fix

      Method perform has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def perform(idplantilla, cmodelo, ccontrolador, ids, narch, parsimp,
            extension, campoid = :id, params = nil)
            puts "Inicio de generación de plantilla #{idplantilla}, con modelo #{cmodelo}, controlador #{ccontrolador}, cantidad de ids #{ids.length}, en #{narch}#{extension}"
            plant = Heb412Gen::Plantillahcm.find(idplantilla)
            controlador = ccontrolador.constantize
      Severity: Minor
      Found in app/jobs/heb412_gen/generalistado_job.rb - About 4 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 modelos_controller.rb has 332 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Heb412Gen
        class ModelosController < Msip::ModelosController
          # Sin control de autorización porquue es usada por otras clases
          # que si lo deben implementar
          def importa_dato_gen(datosent, datossal, menserror, registro = nil, opciones = {})
      Severity: Minor
      Found in app/controllers/heb412_gen/modelos_controller.rb - About 4 hrs to fix

        Method index has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                  def index
                    authorize!(:read, Heb412Gen::Doc)
                    if current_usuario &&
                        ::Ability.respond_to?(:externo?) && ::Ability.externo?(current_usuario)
                      if request.path != "/sis/arch/generados"
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/sisarch_controller.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 perform has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def perform(idplantilla, cmodelo, ccontrolador, ids, narch, parsimp,
              extension, campoid = :id, params = nil)
              puts "Inicio de generación de plantilla #{idplantilla}, con modelo #{cmodelo}, controlador #{ccontrolador}, cantidad de ids #{ids.length}, en #{narch}#{extension}"
              plant = Heb412Gen::Plantillahcm.find(idplantilla)
              controlador = ccontrolador.constantize
        Severity: Major
        Found in app/jobs/heb412_gen/generalistado_job.rb - About 2 hrs to fix

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

                    def importadatos
                      if params && params[:filtro] &&
                          params[:filtro][:plantillahcm_id] && params[:filtro][:archivo]
          
                        if params[:filtro][:plantillahcm_id].to_i <= 0
          Severity: Major
          Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 2 hrs to fix

            Method presenta_contenido has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                      def presenta_contenido(rr, modhistorial = true)
                        @leeme = nil
                        @dir = []
                        cotejador = TwitterCldr::Collation::Collator.new(
                          Rails.configuration.i18n.default_locale,
            Severity: Minor
            Found in lib/heb412_gen/concerns/controllers/sisarch_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

            Method llena_plantilla_multiple_fd has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                      def self.llena_plantilla_multiple_fd(plantillahcm, fd,
                        nomcontrolador = nil)
                        ruta = File.join(
                          Rails.application.config.x.heb412_ruta,
                          plantillahcm.ruta,
            Severity: Minor
            Found in lib/heb412_gen/concerns/controllers/plantillahcm_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

            Method llena_plantilla_fd has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                      def self.llena_plantilla_fd(plantillahcr, fd)
                        ruta = File.join(
                          Rails.application.config.x.heb412_ruta,
                          plantillahcr.ruta,
                        ).to_s
            Severity: Minor
            Found in lib/heb412_gen/concerns/controllers/plantillahcr_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

            Class ModelosController has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class ModelosController < Msip::ModelosController
                # Sin control de autorización porquue es usada por otras clases
                # que si lo deben implementar
                def importa_dato_gen(datosent, datossal, menserror, registro = nil, opciones = {})
                  if registro.nil?
            Severity: Minor
            Found in app/controllers/heb412_gen/modelos_controller.rb - About 2 hrs to fix

              File sisarch_controller.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "cgi"
              
              module Heb412Gen
                module Concerns
                  module Controllers
              Severity: Minor
              Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb - About 2 hrs to fix

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

                          def importadatos
                            if params && params[:filtro] &&
                                params[:filtro][:plantillahcm_id] && params[:filtro][:archivo]
                
                              if params[:filtro][:plantillahcm_id].to_i <= 0
                Severity: Minor
                Found in lib/heb412_gen/concerns/controllers/plantillahcm_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

                Method programa_generacion_listado has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def programa_generacion_listado(params, extension, campoid = :id)
                      if params[:idplantilla].nil? or params[:idplantilla].to_i <= 0 or
                          @registros == []
                        flash[:error] = "No hay registros por generar"
                      elsif Heb412Gen::Plantillahcm.where(
                Severity: Major
                Found in app/controllers/heb412_gen/modelos_controller.rb - About 2 hrs to fix

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

                            def index
                              authorize!(:read, Heb412Gen::Doc)
                              if current_usuario &&
                                  ::Ability.respond_to?(:externo?) && ::Ability.externo?(current_usuario)
                                if request.path != "/sis/arch/generados"
                  Severity: Minor
                  Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb - About 1 hr to fix

                    Method presenta_contenido has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def presenta_contenido(rr, modhistorial = true)
                                @leeme = nil
                                @dir = []
                                cotejador = TwitterCldr::Collation::Collator.new(
                                  Rails.configuration.i18n.default_locale,
                    Severity: Minor
                    Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb - About 1 hr to fix

                      Method campos_vista_formulario has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def campos_vista_formulario(v, formularios, agrega_ult_ed)
                            ab = ::Ability.new
                            col = if v.nil? || ab.campos_plantillas[v].nil?
                              [["", ""]]
                            else
                      Severity: Minor
                      Found in app/helpers/heb412_gen/plantilla_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

                      Method programa_generacion_listado_int has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def programa_generacion_listado_int(params, extension, campoid, pl, narch)
                            ids = @registros.map(&campoid)
                      
                            parsimp = {}
                            parsimp[:busfechainicio_ini] = nil
                      Severity: Minor
                      Found in app/controllers/heb412_gen/modelos_controller.rb - About 1 hr to fix

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

                                  def pintacampos
                                    @plantillahcm = Heb412Gen::Plantillahcm.new
                                    if params[:vista]
                                      vista = Msip::Ubicacion.connection.quote_string(
                                        params[:vista],
                        lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb on lines 23..46

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language