Kentico/delivery-sdk-ruby

View on GitHub

Showing 3 of 16 total issues

Class DeliveryQuery has 22 methods (exceeds 20 allowed). Consider refactoring.
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
Severity: Minor
Found in lib/delivery/client/delivery_query.rb - About 2 hrs to fix

    Method continue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    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
    
    
    Severity: Minor
    Found in lib/delivery/client/request_manager.rb - About 35 mins to fix

    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

              def provide_url(matches, id)
                if matches.empty?
                  if @not_found_handler.nil?
                    resolve_404 id
                  else
    Severity: Minor
    Found in lib/delivery/resolvers/content_link_resolver.rb - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language