technion/ruby-argon2

View on GitHub
lib/argon2/ffi_engine.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def self.hash_argon2id(password, salt, t_cost, m_cost, p_cost, out_len = nil)
Severity: Minor
Found in lib/argon2/ffi_engine.rb - About 45 mins to fix

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

        def self.hash_argon2id_encode(password, salt, t_cost, m_cost, p_cost, secret)
          result = ''
          secretlen = secret.nil? ? 0 : secret.bytesize
          passwordlen = password.nil? ? 0 : password.bytesize
          raise ArgonHashFail, "Invalid salt size" if salt.length != Constants::SALT_LEN
    Severity: Minor
    Found in lib/argon2/ffi_engine.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 hash_argon2id_encode has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.hash_argon2id_encode(password, salt, t_cost, m_cost, p_cost, secret)
    Severity: Minor
    Found in lib/argon2/ffi_engine.rb - About 45 mins to fix

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

          def self.hash_argon2i(password, salt, t_cost, m_cost, out_len = nil)
      Severity: Minor
      Found in lib/argon2/ffi_engine.rb - About 35 mins to fix

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

            def self.argon2_verify(pwd, hash, secret)
              secretlen = secret.nil? ? 0 : secret.bytesize
              passwordlen = pwd.nil? ? 0 : pwd.bytesize
        
              ret = Ext.wrap_argon2_verify(hash, pwd, passwordlen, secret, secretlen)
        Severity: Minor
        Found in lib/argon2/ffi_engine.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