Showing 8 of 14 total issues
Method when
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def when
starts = DateTime.parse(self[:start_at])
ends = DateTime.parse(self[:end_at])
starts_month = starts.strftime("%b")
- 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 on_complete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_complete(env)
if (env[:response_headers][:content_type] || "").start_with? 'application/json'
if respond_to?(:parse)
env[:body] = parse(env[:body]) unless [204, 301, 302, 304].include?(env[:status])
end
- 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 request_setup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_setup(method, path, params)
proc do |request|
if @access_token
request.headers["X-ACCESS-TOKEN"] = @access_token
elsif @xapp_token
- 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 object_from_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def object_from_response(instance, klass, request_method, path, options = {})
Method objects_from_response_feed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def objects_from_response_feed(instance, klass, request_method, path, options = {})
Method objects_from_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def objects_from_response(instance, klass, request_method, path, options = {})
Method authenticate!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
configure!
validate_credentials!
if @user_email && @user_password && @client_id && @client_secret
@logger.debug "GET /oauth2/access_token?client_id=#{CGI.escape(@client_id)}&client_secret=#{CGI.escape(@client_secret)}&email=#{CGI.escape(@user_email)}&password=********&grant_type=credentials" if @logger
- 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_credentials!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_credentials!
if @access_token
# access token gives a user login
elsif @client_id && @client_secret
# client id and secret give access to an xapp token
- 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"