pasosdeJesus/cor1440_gen

View on GitHub

Showing 234 of 234 total issues

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

          def asistentes_con_buena_edad
            self.asistencia.each do |a|
              p = a.persona
              if p && p.anionac && (p.anionac > self.fecha.year ||
                  (p.mesnac && p.anionac == self.fecha.year &&
Severity: Minor
Found in lib/cor1440_gen/concerns/models/actividad.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

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

          def intentar_eliminar_registro_asistente(a)
            if Cor1440Gen::Asistencia.where(persona_id: a.persona_id)
                .where("actividad_id<>?", @registro.id).count > 0
              return false
            end
Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/actividades_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

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

          def fecha_concuerda_responsable_habilitado
            if fecha && responsable
              if responsable.fechacreacion > fecha
                errors.add(:responsable, "Responsable tiene " +
                           " fecha de creación posterior a la actividad")
Severity: Minor
Found in lib/cor1440_gen/concerns/models/actividad.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

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

          def self.asegura_camposdinamicos(persona, current_usuario_id)
            if persona.respond_to?(:proyectofinanciero)
              persona.proyectofinanciero.each do |pf|
                pf.caracterizacion.each do |ca|
                  cp = Cor1440Gen::Caracterizacionpersona.where(
Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/personas_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

        when "aplana"
          if args.count != 1
            STDERR.puts "** Función #{fun} requiere un parámetro"
            return nil
          end
Severity: Minor
Found in app/helpers/cor1440_gen/medicion_helper.rb and 1 other location - About 55 mins to fix
app/helpers/cor1440_gen/medicion_helper.rb on lines 134..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 45.

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

          def disponibles_cor1440_gen(filtro, ability, c = nil)
            if c.nil?
              c = Cor1440Gen::Proyectofinanciero
            end
            c2 = c.accessible_by(ability)
Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_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

        when "cuenta"
          if args.count != 1
            STDERR.puts "** Función #{fun} requiere un parámetro"
            return nil
          end
Severity: Minor
Found in app/helpers/cor1440_gen/medicion_helper.rb and 1 other location - About 55 mins to fix
app/helpers/cor1440_gen/medicion_helper.rb on lines 122..132

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

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 SectoresapcController
        extend ActiveSupport::Concern

Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/sectoresapc_controller.rb and 1 other location - About 55 mins to fix
lib/cor1440_gen/concerns/controllers/sectoresactores_controller.rb on lines 4..35

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

  module Concerns
    module Controllers
      module SectoresactoresController
        extend ActiveSupport::Concern

lib/cor1440_gen/concerns/controllers/sectoresapc_controller.rb on lines 4..35

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

Avoid deeply nested control flow statements.
Open

                    return resultado.resultado ? resultado.resultado : ""
Severity: Major
Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

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

              def new
                if params[:mindicadorpf_id] && Cor1440Gen::Mindicadorpf.where(id: params[:mindicadorpf_id].to_i).count == 1
                  mind = Cor1440Gen::Mindicadorpf.find(params[:mindicadorpf_id].to_i)
                  fini = Date.today
                  ffin = fini + 1.month
    Severity: Minor
    Found in lib/cor1440_gen/concerns/controllers/pmsindicadorpf_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

    Avoid deeply nested control flow statements.
    Open

                        return ref ? ref.numero + ref.objetivopf.numero : ""
    Severity: Major
    Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          return resultado.numero ? resultado.numero : ""
      Severity: Major
      Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            return indicadorob.numero ? indicadorob.numero : ""
        Severity: Major
        Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              return indicadorob.tipoindicador ? indicadorob.tipoindicador.nombre : ""
          Severity: Major
          Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                return resultado.objetivopf ? resultado.objetivopf.numero : ""
            Severity: Major
            Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix

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

                        def presenta_nombre
                          r = "#{campotind.presenta_nombre}: "
                          if !campotind.tipo || campotind.tipo == 1 || campotind.tipo == 2 ||
                              campotind.tipo == 3
                            r += "#{valor}"
              Severity: Minor
              Found in lib/cor1440_gen/concerns/models/valorcampotind.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

              Avoid deeply nested control flow statements.
              Open

                                    unless valorcampo[f.id][campo.id].valorjson
                                      valorcampo[f.id][campo.id].valorjson = []
                                    end
              Severity: Major
              Found in lib/cor1440_gen/concerns/models/persona.rb - About 45 mins to fix

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

                          def medir_indicador
                            prob = ""
                            if params[:finicio] &&
                                params[:finicio] != "" &&
                                params[:ffin] &&
                Severity: Minor
                Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_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

                Avoid deeply nested control flow statements.
                Open

                                    return indicadorob.indicador ? indicadorob.indicador : ""
                Severity: Major
                Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language