Maquech/MX-ID

View on GitHub

Showing 7 of 7 total issues

Method valido? has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def valido?(rfc, fecha = nil, msgs = "", persona_fisica = true)
      msgs = "" if msgs.nil?
      msg = []
      unless rfc.blank?
        return true if rfc == RFC_EXTRANJEROS or rfc == RFC_PUBLICO_GENERAL
Severity: Minor
Found in lib/MX/ID/RFC.rb - About 4 hrs 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

Class RFC has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class MX::ID::RFC
  include MX::ID::Auxiliar
  
  ### Tablas de los Anexos ###
  ANEXO_I = {
Severity: Minor
Found in lib/MX/ID/RFC.rb - About 3 hrs to fix

    File RFC.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MX::ID::RFC
      include MX::ID::Auxiliar
      
      ### Tablas de los Anexos ###
      ANEXO_I = {
    Severity: Minor
    Found in lib/MX/ID/RFC.rb - About 2 hrs to fix

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

          def fecha_coincide?(dia_str, mes_str, año_str, fecha_coincidente = nil, tipo_fecha = "nacimiento", msg = [])
            errores = false
            begin
              if Date.valid_date?(año_str.to_i, mes_str.to_i, dia_str.to_i)
                unless fecha_coincidente.nil?
      Severity: Minor
      Found in lib/MX/ID/auxiliar.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 valido? has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def valido?(rfc, fecha = nil, msgs = "", persona_fisica = true)
            msgs = "" if msgs.nil?
            msg = []
            unless rfc.blank?
              return true if rfc == RFC_EXTRANJEROS or rfc == RFC_PUBLICO_GENERAL
      Severity: Minor
      Found in lib/MX/ID/RFC.rb - About 1 hr to fix

        Method fecha_coincide? has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def fecha_coincide?(dia_str, mes_str, año_str, fecha_coincidente = nil, tipo_fecha = "nacimiento", msg = [])
        Severity: Minor
        Found in lib/MX/ID/auxiliar.rb - About 45 mins to fix

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

              def digito_verificador(rfc)
                raise ArgumentError.new("la longitud del R.F.C. es incorrecta. Usar 11 o 12 caracteres.") unless rfc.size.between?(11,12)
                rfc_12_posiciones = rfc.size == 11 ? " " + rfc : rfc
                suma = 0
                13.downto(2){ |i| suma += ANEXO_III[rfc_12_posiciones[(i-13)*(-1)]].to_i * i }
          Severity: Minor
          Found in lib/MX/ID/RFC.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

          Severity
          Category
          Status
          Source
          Language