GemHQ/secp256k1-rb

View on GitHub

Showing 3 of 5 total issues

Method recover_compact has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def self.recover_compact(message, signature)
    init

    return nil if signature.bytesize != 65

Severity: Minor
Found in lib/secp256k1/ffi.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 generate_key_pair has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate_key_pair(compressed=true)
    init

    while true do
      priv_key = SecureRandom.random_bytes(32)
Severity: Minor
Found in lib/secp256k1/ffi.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 sign_compact has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.sign_compact(message, priv_key, compressed=true)
    init

    message_buf = FFI::MemoryPointer.new(:uchar, message.bytesize)
    message_buf.put_bytes(0, message)
Severity: Minor
Found in lib/secp256k1/ffi.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