technion/ruby-argon2

View on GitHub

Showing 6 of 6 total issues

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

          def initialize(digest)
            digest = digest.to_s unless digest.is_a?(String)
      
            raise Argon2::ArgonHashFail, 'Invalid Argon2 hash' unless self.class.valid_hash?(digest)
      
      
      Severity: Minor
      Found in lib/argon2/hash_format.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_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

        Severity
        Category
        Status
        Source
        Language