Showing 67 of 1,476 total issues
Method type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def type(chain, key, param, value)
return if value.nil?
t = TYPES[key] or return value
p = t[param] or return value
- 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
Avoid too many return
statements within this method. Open
return yield(response.result, response.error, response.id)
Avoid too many return
statements within this method. Open
return yield(response.result.values.first, response.error, response.id)
Avoid too many return
statements within this method. Open
return response
Method network_api
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.network_api(chain, api_name, options = {})
api = case chain.to_sym
when :steem then Steem::Api.clone(freeze: false) rescue Api.clone
when :hive then Hive::Api.clone(freeze: false) rescue Api.clone
else; raise ApiError, "Unsupported chain: #{chain}"
- 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 backoff
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def backoff
shutdown
bump_failover if flappy? || !healthy?(uri)
@backoff_at ||= Time.now.utc
@backoff_sleep ||= 0.01
- 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_s
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if !!@cause
JSON[error: @error, cause: @cause] rescue {error: @error, cause: @cause}.to_s
else
JSON[@error] rescue @error
- 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"