Showing 5 of 17 total issues
Class Client
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
USER_AGENT = "Ruby Bitly/#{Bitly::VERSION}"
##
# Creates a new Bitly::API::Client, authorized with an OAuth token and
Method initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(status:, body:, headers:, request: nil)
errors = []
@status = status
errors << "Status must be a valid HTTP status code. Received #{status}" unless is_status?(status)
if body.nil? || body.empty?
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(uri: , method: "GET", params: {}, headers: {})
errors = []
@uri = uri
errors << "uri must be an object of type URI. Received a #{uri.class}" unless uri.kind_of?(URI)
@method = method
- 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 assign_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def assign_attributes(attributes)
if self.class.respond_to?(:attributes)
self.class.attributes.each do |attr|
instance_variable_set("@#{attr}", attributes[attr.to_s]) if attributes[attr.to_s]
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 access_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def access_token(redirect_uri: nil, code: nil, username: nil, password: nil)
begin
if redirect_uri && code
access_token_from_code(redirect_uri: redirect_uri, code: code)
elsif username && password
- 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"