Showing 3 of 16 total issues
Class DeliveryQuery
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class DeliveryQuery
ERROR_PREVIEW = 'Preview is enabled for the query, but the key is null. '\
'You can set the preview_key attribute of the query, or '\
'when you initialize the client. See '\
'https://github.com/kontent-ai/delivery-sdk-ruby#previewing-unpublished-content'.freeze
Method continue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def continue
if ENV['TEST'] == '1'
resp = Kontent::Ai::Delivery::Tests::FakeResponder.get_response @query, @url, @headers
return should_retry(resp) if resp.is_a? Kontent::Ai::Delivery::Responses::ResponseBase
- 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 provide_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def provide_url(matches, id)
if matches.empty?
if @not_found_handler.nil?
resolve_404 id
else
- 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"