pasosdeJesus/heb412_gen

View on GitHub

Showing 73 of 73 total issues

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

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

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

    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

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

            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

              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

                          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

                    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

              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

              Severity
              Category
              Status
              Source
              Language