pasosdeJesus/heb412_gen

View on GitHub

Showing 82 of 82 total issues

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

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

                def pintacampos
                  @plantillahcr = Heb412Gen::Plantillahcr.new
                  if params[:vista]
                    vista = Msip::Ubicacion.connection.quote_string(
                      params[:vista],
      lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 24..47

      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

      Function completarEnlacePlantilla has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static completarEnlacePlantilla(
          elema, idselplantilla, idruta, rutagenera, formatosalida = 'ods'
        ) {
          let formato = formatosalida
          let p = $(idselplantilla).val().split('.')
      Severity: Minor
      Found in app/javascript/controllers/motor.js - About 1 hr to fix

        Method llena_plantilla_fd has 33 lines of code (exceeds 25 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 1 hr to fix

          Method fichaimp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def fichaimp
                establece_registro
                unless @registro
                  return
                end
          Severity: Minor
          Found in app/controllers/heb412_gen/modelos_controller.rb - About 1 hr to fix

            Method llena_plantilla_multiple_fd has 31 lines of code (exceeds 25 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 1 hr to fix

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

                            if File.exist?("#{nfuente}.xlsx")
                              File.delete("#{nfuente}.xlsx")
                            end
                            dir = File.dirname(ndest)
                            bn = File.basename(ndest)
              lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 240..248

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

              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

                            if File.exist?("#{nfuente}.pdf")
                              File.delete("#{nfuente}.pdf")
                            end
                            dir = File.dirname(ndest)
                            bn = File.basename(ndest)
              lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 251..259

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

              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 update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def update
                          authorize!(:edit, Heb412Gen::Plantillahcr)
                          @vista = @plantillahcr.vista
                          respond_to do |format|
                            if @plantillahcr.update(plantillahcr_params)
              Severity: Minor
              Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb - About 1 hr to fix

                Method perform has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def perform(idplantilla, cmodelo, ccontrolador, ids, narch, parsimp,
                      extension, campoid = :id, params = nil)
                Severity: Major
                Found in app/jobs/heb412_gen/generalistado_job.rb - About 1 hr to fix

                  Method vista_listado has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.vista_listado(plant, ids, modelo, narch, parsimp, extension,
                        campoid = :id, params = nil, controlador = nil)
                  Severity: Major
                  Found in app/controllers/heb412_gen/modelos_controller.rb - About 1 hr to fix

                    Method programa_generacion_listado has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                    Found in app/controllers/heb412_gen/modelos_controller.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 convierte_a_extension_esperada has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def self.convierte_a_extension_esperada(nfuente, ndest, extension)
                                if extension == ".ods"
                                  FileUtils.mv(nfuente, "#{ndest}#{extension}")
                                elsif extension == ".pdf"
                                  if File.exist?("#{nfuente}.pdf")
                    Severity: Minor
                    Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.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 fichapdf has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def fichapdf
                          establece_registro
                          unless @registro
                            return
                          end
                    Severity: Minor
                    Found in app/controllers/heb412_gen/modelos_controller.rb - About 1 hr to fix

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

                                def pintacampos
                                  @plantillahcm = Heb412Gen::Plantillahcm.new
                                  if params[:vista]
                                    vista = Msip::Ubicacion.connection.quote_string(
                                      params[:vista],
                      Severity: Minor
                      Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 1 hr to fix

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

                                  def pintacampos
                                    @plantillahcr = Heb412Gen::Plantillahcr.new
                                    if params[:vista]
                                      vista = Msip::Ubicacion.connection.quote_string(
                                        params[:vista],
                        Severity: Minor
                        Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb - About 1 hr to fix

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

                                      document.addEventListener("click", (e) => {
                                        if (e.button == 0) {
                                          document.querySelector(".heb412_menucontextual").style.display = "none"
                                        }
                                      })
                          Severity: Major
                          Found in app/javascript/controllers/motor.js and 1 other location - About 1 hr to fix
                          app/javascript/controllers/motor.js on lines 102..106

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

                          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