Showing 4 of 6 total issues

Class Client has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Client
      include EventEmitter

      # @!visibility private
      # The default properties for the identify packet
Severity: Minor
Found in lib/vox/gateway/client.rb - About 3 hrs to fix

    Method update has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def update(key, bucket_id, limit, remaining, reset_time)
    Severity: Minor
    Found in lib/vox/http/middleware/rate_limiter.rb - About 35 mins to fix

      Method update_from_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_from_headers(key, headers, req_id = nil)
              limit = headers['x-ratelimit-limit']&.to_i
              remaining = headers['x-ratelimit-remaining']&.to_i
              bucket_id = headers['x-ratelimit-bucket']
              reset_after = headers['x-ratelimit-reset-after']&.to_f
      Severity: Minor
      Found in lib/vox/http/middleware/rate_limiter.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 handle_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def handle_response(resp, raw, req_id)
              raise Error::ServerError.new(req_id) if (500..600).cover? resp.status
      
              return nil if resp.status == 204 || resp.status == 304
      
      
      Severity: Minor
      Found in lib/vox/http/client.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