Showing 11 of 13 total issues

Method Ng has 160 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def Ng(group)
    case group
    when 1024
      @N = %w(
        EEAF0AB9 ADB38DD6 9C33F80A FA8FC5E8 60726187 75FF3C0B 9EA2314C
Severity: Major
Found in lib/sirp/parameters.rb - About 6 hrs to fix

    Method get_challenge_and_proof has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_challenge_and_proof(username, xverifier, xsalt, xaa)
          raise ArgumentError, 'username must be a string' unless username.is_a?(String) && !username.empty?
          raise ArgumentError, 'xverifier must be a string' unless xverifier.is_a?(String)
          raise ArgumentError, 'xverifier must be a hex string' unless xverifier =~ /^[a-fA-F0-9]+$/
          raise ArgumentError, 'xsalt must be a string' unless xsalt.is_a?(String)
    Severity: Minor
    Found in lib/sirp/verifier.rb - About 2 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

    Method process_challenge has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_challenge(username, password, xsalt, xbb)
          raise ArgumentError, 'username must be a string' unless username.is_a?(String) && !username.empty?
          raise ArgumentError, 'password must be a string' unless password.is_a?(String) && !password.empty?
          raise ArgumentError, 'xsalt must be a string' unless xsalt.is_a?(String)
          raise ArgumentError, 'xsalt must be a hex string' unless xsalt =~ /^[a-fA-F0-9]+$/
    Severity: Minor
    Found in lib/sirp/client.rb - About 2 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

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

        def verify_session(proof, client_M)
          raise ArgumentError, 'proof must be a hash' unless proof.is_a?(Hash)
          symbolize_keys_deep!(proof)
          raise ArgumentError, 'proof must have required hash keys' unless proof.keys == [:A, :B, :b, :I, :s, :v]
          raise ArgumentError, 'client_M must be a string' unless client_M.is_a?(String)
    Severity: Minor
    Found in lib/sirp/verifier.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 H has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def H(hash_klass, n, *a)
        nlen = 2 * ((('%x' % [n]).length * 4 + 7) >> 3)
    
        hashin = a.map do |s|
          next unless s
    Severity: Minor
    Found in lib/sirp/sirp.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 calc_client_S has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def calc_client_S(bb, a, k, x, u, n, g)
    Severity: Major
    Found in lib/sirp/sirp.rb - About 50 mins to fix

      Method calc_server_S has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def calc_server_S(aa, b, v, u, n)
      Severity: Minor
      Found in lib/sirp/sirp.rb - About 35 mins to fix

        Method calc_B has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def calc_B(b, k, v, n, g)
        Severity: Minor
        Found in lib/sirp/sirp.rb - About 35 mins to fix

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

              def verify(server_HAMK)
                return false unless @H_AMK && server_HAMK
                return false unless server_HAMK.is_a?(String)
                return false unless server_HAMK =~ /^[a-fA-F0-9]+$/
          
          
          Severity: Minor
          Found in lib/sirp/client.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 generate_userauth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_userauth(username, password)
                raise ArgumentError, 'username must be a string' unless username.is_a?(String) && !username.empty?
                raise ArgumentError, 'password must be a string' unless password.is_a?(String) && !password.empty?
          
                @salt ||= SecureRandom.hex(10)
          Severity: Minor
          Found in lib/sirp/verifier.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 symbolize_keys_deep! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def symbolize_keys_deep!(h)
                h.keys.each do |k|
                  ks = k.respond_to?(:to_sym) ? k.to_sym : k
                  h[ks] = h.delete k # Preserve order even when k == ks
                  symbolize_keys_deep! h[ks] if h[ks].kind_of? Hash
          Severity: Minor
          Found in lib/sirp/verifier.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

          Severity
          Category
          Status
          Source
          Language