codegram/hyperclient

View on GitHub

Showing 5 of 5 total issues

Class Link has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Link
    include Enumerable

    # Public: Initializes a new Link.
    #
Severity: Minor
Found in lib/hyperclient/link.rb - About 3 hrs to fix

    Method each has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def each(&block)
          if block_given?
            current = self
            while current
              coll = current.respond_to?(@key) ? current.send(@key) : _resource
    Severity: Minor
    Found in lib/hyperclient/link.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 connection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def connection(options = {}, &block)
          @faraday_options ||= options.dup
          if block_given?
            raise ConnectionAlreadyInitializedError if @connection
    
    
    Severity: Minor
    Found in lib/hyperclient/entry_point.rb - About 55 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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def method_missing(method, *args, &block)
          if args.any? && args.first.is_a?(Hash)
            _links.send(method, [], &block)._expand(*args)
          elsif !Array.method_defined?(method)
            %i[_attributes _embedded _links].each do |target|
    Severity: Minor
    Found in lib/hyperclient/resource.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 delegate_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def delegate_method(method, *args, &block)
          return unless @key && _resource.respond_to?(@key)
    
          @delegate ||= _resource.send(@key)
          return unless @delegate&.respond_to?(method.to_s)
    Severity: Minor
    Found in lib/hyperclient/link.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