zendesk/zendesk_api_client_rb

View on GitHub
lib/zendesk_api/collection.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Collection has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Collection
    include ZendeskAPI::Sideloading

    # Options passed in that are automatically converted from an array to a comma-separated list.
    SPECIALLY_JOINED_PARAMS = [:ids, :only]
Severity: Minor
Found in lib/zendesk_api/collection.rb - About 6 hrs to fix

    File collection.rb has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'zendesk_api/resource'
    require 'zendesk_api/resources'
    
    module ZendeskAPI
      # Represents a collection of resources. Lazily loaded, resources aren't
    Severity: Minor
    Found in lib/zendesk_api/collection.rb - About 3 hrs to fix

      Method _all has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _all(start_page = @options["page"], bang = false, &block)
            raise(ArgumentError, "must pass a block") unless block
      
            page(start_page)
            clear_cache
      Severity: Minor
      Found in lib/zendesk_api/collection.rb - About 1 hr 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 wrap_resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def wrap_resource(res, with_association = with_association?)
            case res
            when Array
              wrap_resource(Hash[*res], with_association)
            when Hash
      Severity: Minor
      Found in lib/zendesk_api/collection.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

      Method _save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _save(method = :save)
            return self unless @resources
      
            result = true
      
      
      Severity: Minor
      Found in lib/zendesk_api/collection.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

      Method get_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_response(path)
            @error = nil
            @response = @client.connection.send(@verb || "get", path) do |req|
              opts = @options.delete_if { |_, v| v.nil? }
      
      
      Severity: Minor
      Found in lib/zendesk_api/collection.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

      There are no issues that match your filters.

      Category
      Status