pasosdeJesus/sivel2_gen

View on GitHub
app/helpers/sivel2_gen/rangoedad_helper.rb

Summary

Maintainability
B
6 hrs
Test Coverage
F
54%

Method edad_de_fechanac_fecha has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def edad_de_fechanac_fecha(anionac, mesnac, dianac, 
                                  anio, mes, dia)
      if anionac.nil? || anionac == ''
        return -1
      end
Severity: Minor
Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 1 hr 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 poblacion_por_sexo_rango has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def poblacion_por_sexo_rango(caso_id, anio, mes, dia, modelorango, rangoedad, totsexo)
Severity: Major
Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix

    Method poblacion_por_rango_sexo has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def poblacion_por_rango_sexo(caso_id, anio, mes, dia, modelorango, 
                                     rangoedadsexo, totsexo)
    Severity: Major
    Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 50 mins to fix

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

          def poblacion_por_sexo_rango(caso_id, anio, mes, dia, modelorango, rangoedad, totsexo)
            caso = Sivel2Gen::Caso.where(id: caso_id)
            if caso.count < 1 
              return false
            end
      Severity: Minor
      Found in app/helpers/sivel2_gen/rangoedad_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 poblacion_por_rango_sexo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def poblacion_por_rango_sexo(caso_id, anio, mes, dia, modelorango, 
                                       rangoedadsexo, totsexo)
            caso = Sivel2Gen::Caso.where(id: caso_id)
            if caso.count < 1 
              return false
      Severity: Minor
      Found in app/helpers/sivel2_gen/rangoedad_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 edad_de_fechanac_fecha has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def edad_de_fechanac_fecha(anionac, mesnac, dianac, 
                                        anio, mes, dia)
      Severity: Minor
      Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 && 
                    dianac > dia)
                  na -= 1
                end
        Severity: Major
        Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 40 mins to fix

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

              def buscar_rango_edad(edad, modelorango)
                if (!modelorango || !defined?(modelorango.constantize) || 
                    !defined?(!modelorango.constantize.habilitados))
                  puts "No se pudo usar modelorango"
                  return -1
          Severity: Minor
          Found in app/helpers/sivel2_gen/rangoedad_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

          There are no issues that match your filters.

          Category
          Status