pasosdeJesus/heb412_gen

View on GitHub

Showing 82 of 82 total issues

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

    def importa_dato(datosent, datossal, menserror, registro = nil, opciones = {})
Severity: Minor
Found in app/controllers/heb412_gen/modelos_controller.rb - About 35 mins to fix

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

        def importa_dato_gen(datosent, datossal, menserror, registro = nil, opciones = {})
    Severity: Minor
    Found in app/controllers/heb412_gen/modelos_controller.rb - About 35 mins to fix

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

          def complementa_importa_dato(registro, ulteditor_id, datossal,
            menserror, opciones = {})
      Severity: Minor
      Found in app/controllers/heb412_gen/modelos_controller.rb - About 35 mins to fix

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

                    plantillahcm, controlador, modelo, narchent, ulteditor_id
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 35 mins to fix

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

              def programa_generacion_listado_int(params, extension, campoid, pl, narch)
          Severity: Minor
          Found in app/controllers/heb412_gen/modelos_controller.rb - About 35 mins to fix

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

                        if !params || !params[:nueva] ||
                            !params[:nueva][:ruta] ||
                            !limpia_ruta(params[:nueva][:ruta]) ||
                            params[:nueva][:nombre].nil?
                          redirect_to(Rails.configuration.relative_url_root)
            Severity: Minor
            Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb and 1 other location - About 35 mins to fix
            lib/heb412_gen/concerns/controllers/sisarch_controller.rb on lines 182..188

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

            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 !params || !params[:nuevo] ||
                            !params[:nuevo][:ruta] ||
                            !limpia_ruta(params[:nuevo][:ruta]) ||
                            params[:nuevo][:archivo].nil?
                          redirect_to(Rails.configuration.relative_url_root)
            Severity: Minor
            Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb and 1 other location - About 35 mins to fix
            lib/heb412_gen/concerns/controllers/sisarch_controller.rb on lines 160..166

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

            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

                  cols.each do |icol|
                    comp = compara_columnas(icol[1], col)
                    next unless comp > 0
            
                    # Mueve cada una de las que esté a la derecha de la col-esima
            Severity: Minor
            Found in app/helpers/heb412_gen/plantilla_helper.rb and 1 other location - About 35 mins to fix
            app/helpers/heb412_gen/plantilla_helper.rb on lines 138..144

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

            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

                  cols.each do |icol|
                    comp = compara_columnas(icol[1], col)
                    next unless comp >= 0
            
                    c = Heb412Gen::Campoplantillahcm.find(icol[0])
            Severity: Minor
            Found in app/helpers/heb412_gen/plantilla_helper.rb and 1 other location - About 35 mins to fix
            app/helpers/heb412_gen/plantilla_helper.rb on lines 177..184

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

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

                def sigcol(col)
                  res = ""
                  i = col.length - 1
                  lleva = 1
                  while i >= 0
            Severity: Minor
            Found in app/helpers/heb412_gen/plantilla_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

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

                def permiso_ver_leer(ruta, carpeta, usuario)
                  if usuario.rol == Ability::ROLADMIN || usuario.rol == Ability::ROLDIR ||
                      ruta == "/"
                    return true
                  end
            Severity: Minor
            Found in app/helpers/heb412_gen/permisos_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

            Avoid too many return statements within this method.
            Open

                            return
            Severity: Major
            Found in lib/heb412_gen/concerns/controllers/sisarch_controller.rb - About 30 mins to fix

              Method elimina_columna has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def elimina_columna(plantillahcm_id, id)
                    pore = Heb412Gen::Campoplantillahcm
                      .where(plantillahcm_id: plantillahcm_id).where(id: id).take
                    unless pore
                      raise "No se encontró columna con id #{id} en "\
              Severity: Minor
              Found in app/helpers/heb412_gen/plantilla_helper.rb - About 25 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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def perform(idplantilla, nomcontrolador, narchent, narcherr, extension, ulteditor_id)
                    puts "Inicio de generación de plantilla #{idplantilla} con nomcontrolador #{nomcontrolador}, importando de #{narchent} escribiendo errores en #{narcherr} con extensión #{extension} ulteditor_id es #{ulteditor_id}"
                    plant = Heb412Gen::Plantillahcm.find(idplantilla)
                    controlador = nomcontrolador.constantize.new
                    modelo = controlador.clase
              Severity: Minor
              Found in app/jobs/heb412_gen/importalistado_job.rb - About 25 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 programa_generacion_listado_int has a Cognitive Complexity of 6 (exceeds 5 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 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                        def create
                          authorize!(:edit, Heb412Gen::Doc)
                          @doc = Heb412Gen::Doc.new(doc_params)
                          if !@doc.nombre && @doc.adjunto_file_name
                            @doc.nombre = @doc.adjunto_file_name
              Severity: Minor
              Found in lib/heb412_gen/concerns/controllers/docs_controller.rb - About 25 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

                module Concerns
                  module Controllers
                    module CamposplantillahcrController
                      extend ActiveSupport::Concern
              
              
              lib/heb412_gen/concerns/controllers/camposplantillahcm_controller.rb on lines 2..20

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

              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

                module Concerns
                  module Controllers
                    module CamposplantillahcmController
                      extend ActiveSupport::Concern
              
              
              lib/heb412_gen/concerns/controllers/camposplantillahcr_controller.rb on lines 2..20

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

              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 destroy
                          authorize!(:edit, Heb412Gen::Plantillahcm)
                          @plantillahcm.destroy
                          respond_to do |format|
                            format.html do
              Severity: Minor
              Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb and 1 other location - About 20 mins to fix
              lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb on lines 180..190

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

              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 destroy
                          authorize!(:edit, Heb412Gen::Plantillahcr)
                          @plantillahcr.destroy
                          respond_to do |format|
                            format.html do
              Severity: Minor
              Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb and 1 other location - About 20 mins to fix
              lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 179..189

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

              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