Showing 4 of 4 total issues
Method decode_token
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.decode_token(token, depth = 16)
parts = token.split(".")
decoded_parts = decode_token_parts(parts)
header = decoded_parts[0]
- Read upRead up
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 decode_token
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decode_token(token, depth = 16)
parts = token.split(".")
decoded_parts = decode_token_parts(parts)
header = decoded_parts[0]
Method token_parts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.token_parts(token)
parts = token.is_a?(Array) ? token : token.split(".")
raise ArgumentError unless parts.length == 5
decoded_parts = parts.map { |part| Sandal::Util.jwt_base64_decode(part) }
return parts, decoded_parts
- Read upRead up
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 validate_aud
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_aud(valid_aud)
return unless valid_aud && valid_aud.length > 0
aud = self["aud"]
aud = [aud] unless aud.is_a?(Array)
- Read upRead up
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"