Showing 27 of 27 total issues
Method initialize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def initialize(http_status, response_body, error_info = nil)
if response_body
self.response_body = response_body.strip
else
self.response_body = ''
- 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 graph_call
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def graph_call(path, args = {}, verb = "get", options = {}, &post_processing)
# enable appsecret_proof by default
options = {:appsecret_proof => true}.merge(options) if @app_secret
response = api(path, args, verb, options)
- 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 to_batch_params
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def to_batch_params(main_access_token, app_secret)
# set up the arguments
if @access_token != main_access_token
@args[:access_token] = @access_token
if app_secret
- 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
Class OAuth
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class OAuth
attr_reader :app_id, :app_secret, :oauth_callback_url
# Creates a new OAuth client.
#
Method execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def execute(http_options = {})
return [] if batch_calls.empty?
batch_results = []
batch_calls.each_slice(MAX_CALLS) do |batch|
- 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 initialize
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(http_status, response_body, error_info = nil)
if response_body
self.response_body = response_body.strip
else
self.response_body = ''
Method parse_media_args
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_media_args(media_args, method)
# photo and video uploads can accept different types of arguments (see above)
# so here, we parse the arguments into a form directly usable in put_connections
raise KoalaError.new("Wrong number of arguments for put_#{method == "photos" ? "picture" : "video"}") unless media_args.size.between?(1, 5)
- 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 use_simple_detection
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def use_simple_detection(filename)
# very rudimentary extension analysis for images
# first, get the downcased extension, or an empty string if it doesn't exist
extension = ((filename.match(/\.([a-zA-Z0-9]+)$/) || [])[1] || "").downcase
case extension
Method parse_signed_cookie
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_signed_cookie(fb_cookie)
components = parse_signed_request(fb_cookie)
if code = components["code"]
begin
token_info = get_access_token_info(code, :redirect_uri => '')
- 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 api
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def api(path, args = {}, verb = "get", options = {})
# we make a copy of args so the modifications (added access_token & appsecret_proof)
# do not affect the received argument
args = args.dup
- 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 make_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.make_request(request)
# set up our Faraday connection
conn = Faraday.new(request.server, faraday_options(request.options), &(faraday_middleware || DEFAULT_MIDDLEWARE))
filtered_args = request.raw_args.dup.transform_keys(&:to_s)
- 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 parse_unsigned_cookie
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_unsigned_cookie(fb_cookie)
# remove the opening/closing quote
fb_cookie = fb_cookie.gsub(/\"/, "")
# since we no longer get individual cookies, we have to separate out the components ourselves
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@app_id = options[:app_id] || Koala.config.app_id
@app_access_token = options[:app_access_token] || Koala.config.app_access_token
@secret = options[:secret] || Koala.config.app_secret
- 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 delete_connections
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_connections(id, connection_name, args = {}, options = {}, &block)
Method put_wall_post
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_wall_post(message, attachment = {}, target_id = "me", options = {}, &block)
Method put_object
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_object(parent_object, connection_name, args = {}, options = {}, &block)
Method put_connections
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_connections(id, connection_name, args = {}, options = {}, &block)
Method subscribe
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def subscribe(object, fields, callback_url, verify_token, options = {})
Method get_connection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_connection(id, connection_name, args = {}, options = {}, &block)
Method set_app_restrictions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_app_restrictions(app_id, restrictions_hash, args = {}, options = {}, &block)