Showing 4 of 6 total issues
Class Client
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Client
include EventEmitter
# @!visibility private
# The default properties for the identify packet
Method update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def update(key, bucket_id, limit, remaining, reset_time)
Method update_from_headers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_from_headers(key, headers, req_id = nil)
limit = headers['x-ratelimit-limit']&.to_i
remaining = headers['x-ratelimit-remaining']&.to_i
bucket_id = headers['x-ratelimit-bucket']
reset_after = headers['x-ratelimit-reset-after']&.to_f
- 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 handle_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def handle_response(resp, raw, req_id)
raise Error::ServerError.new(req_id) if (500..600).cover? resp.status
return nil if resp.status == 204 || resp.status == 304
- 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"