Method get_token
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_token(params, access_token_opts = {}, extract_access_token = nil, &block)
warn('OAuth2::Client#get_token argument `extract_access_token` will be removed in oauth2 v3. Refactor to use `access_token_class` on #initialize.') if extract_access_token
extract_access_token ||= options[:extract_access_token]
params = params.map do |key, value|
if RESERVED_PARAM_KEYS.include?(key)
- Read upRead up
- Create a ticketCreate a ticket
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 request
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def request(verb, url, opts = {}, &block)
response = execute_request(verb, url, opts, &block)
case response.status
when 301, 302, 303, 307
- Read upRead up
- Create a ticketCreate a ticket
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 get_token
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_token(params, access_token_opts = {}, extract_access_token = nil, &block)
warn('OAuth2::Client#get_token argument `extract_access_token` will be removed in oauth2 v3. Refactor to use `access_token_class` on #initialize.') if extract_access_token
extract_access_token ||= options[:extract_access_token]
params = params.map do |key, value|
if RESERVED_PARAM_KEYS.include?(key)
- Create a ticketCreate a ticket
Method request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(verb, url, opts = {}, &block)
response = execute_request(verb, url, opts, &block)
case response.status
when 301, 302, 303, 307
- Create a ticketCreate a ticket
Method execute_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute_request(verb, url, opts = {})
url = connection.build_url(url).to_s
begin
response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
- Read upRead up
- Create a ticketCreate a ticket
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 parse_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(response, access_token_opts)
access_token_class = options[:access_token_class]
data = response.parsed
unless data.is_a?(Hash) && !data.empty?
- Read upRead up
- Create a ticketCreate a ticket
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"