pasosdeJesus/heb412_gen

View on GitHub

Showing 82 of 82 total issues

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

      document.addEventListener("keydown", e => {
        if (e.keyCode == 27) {
          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 86..90

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

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

    Method create_gen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def create_gen(plantillahcr)
                respond_to do |format|
                  if plantillahcr.save
                    ordena_plantillahcr
                    format.html do
    Severity: Minor
    Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb - About 1 hr to fix

      Method create_gen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def create_gen(plantillahcm)
                  respond_to do |format|
                    if plantillahcm.save
                      ordena_plantillahcm
                      format.html do
      Severity: Minor
      Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb - About 1 hr to fix

        Method cons_a_fd has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.cons_a_fd(cons, colvista = [])
              l = []
              cons.each do |r|
                f = {}
                colvista.each do |c|
        Severity: Minor
        Found in app/controllers/heb412_gen/modelos_controller.rb - About 55 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 create_gen(plantillahcm)
                    respond_to do |format|
                      if plantillahcm.save
                        ordena_plantillahcm
                        format.html do
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb and 1 other location - About 55 mins to fix
        lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb on lines 98..121

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

        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 create_gen(plantillahcr)
                    respond_to do |format|
                      if plantillahcr.save
                        ordena_plantillahcr
                        format.html do
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb and 1 other location - About 55 mins to fix
        lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 101..124

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

        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

                    respond_to do |format|
                      if @plantillahcm.update(plantillahcm_params)
                        ordena_plantillahcm
                        format.html do
                          redirect_to(
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb and 1 other location - About 50 mins to fix
        lib/heb412_gen/concerns/controllers/docs_controller.rb on lines 62..72

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

        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

                    respond_to do |format|
                      if @doc.update(doc_params)
                        ordena_doc
                        format.html do
                          redirect_to(@doc, notice: "Doc actualizado.")
        Severity: Minor
        Found in lib/heb412_gen/concerns/controllers/docs_controller.rb and 1 other location - About 50 mins to fix
        lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 152..171

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

        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

                elsif resta == 1 && col[i] == "A"
                  res = "Z" + res
                  resta = 1
                elsif resta == 1
                  c0 = col[i].ord - 1
        Severity: Minor
        Found in app/helpers/heb412_gen/plantilla_helper.rb and 1 other location - About 50 mins to fix
        app/helpers/heb412_gen/plantilla_helper.rb on lines 49..58

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

        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 lleva == 1 && col[i] == "Z"
                  res = "A" + res
                  lleva = 1
                elsif lleva == 1
                  c0 = col[i].ord + 1
        Severity: Minor
        Found in app/helpers/heb412_gen/plantilla_helper.rb and 1 other location - About 50 mins to fix
        app/helpers/heb412_gen/plantilla_helper.rb on lines 83..92

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

        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

        Avoid deeply nested control flow statements.
        Open

                    switch (e.target.id) {
                      case "abrir":
                        window.heb412_mcdir_enlace.click()
                        break
                      case "renombrar":
        Severity: Major
        Found in app/javascript/controllers/motor.js - About 45 mins to fix

          Method fichaimp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def fichaimp
                establece_registro
                unless @registro
                  return
                end
          Severity: Minor
          Found in app/controllers/heb412_gen/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 fichapdf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def fichapdf
                establece_registro
                unless @registro
                  return
                end
          Severity: Minor
          Found in app/controllers/heb412_gen/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 perform has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def perform(idplantilla, nomcontrolador, narchent, narcherr, extension, ulteditor_id)
          Severity: Minor
          Found in app/jobs/heb412_gen/importalistado_job.rb - About 45 mins to fix

            Method antcol has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def antcol(col)
                  if col == ""
                    raise "No puede calcular antcol(nil)"
                  end
            
            
            Severity: Minor
            Found in app/helpers/heb412_gen/plantilla_helper.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 compara_columnas has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def compara_columnas(col1, col2)
                  if col1.length < col2.length
                    return -1
                  end
                  if col2.length < col1.length
            Severity: Minor
            Found in app/helpers/heb412_gen/plantilla_helper.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

                      p = 0
                      if t > 0
                        p = 100 * i / t
                      end
                      if p != ultp
            Severity: Minor
            Found in app/jobs/heb412_gen/generalistado_job.rb and 1 other location - About 40 mins to fix
            app/jobs/heb412_gen/importalistado_job.rb on lines 30..39

            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

                    p = 0
                    if t > 0
                      p = 100 * i / t
                    end
                    if p != ultp
            Severity: Minor
            Found in app/jobs/heb412_gen/importalistado_job.rb and 1 other location - About 40 mins to fix
            app/jobs/heb412_gen/generalistado_job.rb on lines 65..74

            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 (p[1] != 'html' && p[1] != 'ods' && p[1] != 'odt' && p[1] != 'xrlat' && p[1] != 'json' && p[1] != 'csv') {
                    nplantilla = ''
                  } else {
                    formato = p[1]
                    if (formato == 'html' || formato == 'odt' || formato == 'xrlat' || formato == 'json' || formato == 'csv') {
            Severity: Major
            Found in app/javascript/controllers/motor.js - About 40 mins to fix
              Severity
              Category
              Status
              Source
              Language