pasosdeJesus/heb412_gen

View on GitHub

Showing 73 of 73 total issues

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

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

    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

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

              def create
                authorize!(:edit, Heb412Gen::Plantillahcr)
                @plantillahcr = Heb412Gen::Plantillahcr.new(plantillahcr_params)
                if !@plantillahcr.nombremenu && @plantillahcr.ruta
                  @plantillahcr.nombremenu = File.basename(@plantillahcr.ruta)
    Severity: Minor
    Found in lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb and 1 other location - About 15 mins to fix
    lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb on lines 132..138

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

    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
                authorize!(:edit, Heb412Gen::Plantillahcm)
                @plantillahcm = Heb412Gen::Plantillahcm.new(plantillahcm_params)
                if !@plantillahcm.nombremenu && @plantillahcm.ruta
                  @plantillahcm.nombremenu = File.basename(@plantillahcm.ruta)
    Severity: Minor
    Found in lib/heb412_gen/concerns/controllers/plantillahcm_controller.rb and 1 other location - About 15 mins to fix
    lib/heb412_gen/concerns/controllers/plantillahcr_controller.rb on lines 129..135

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

    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