kaneda/buffer-ruby

View on GitHub

Showing 4 of 4 total issues

Class BufferClient has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

class BufferClient
  def initialize(options = {})
    @error = nil

    # Initialize the API objects we may use
Severity: Minor
Found in lib/buffer_client.rb - About 3 hrs to fix

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

      def get_auth_token
        return nil unless verify_user_code && verify_env_vars
    
        oauth_url = build_url(OAUTH_PATH, {}, false)
    
    
    Severity: Minor
    Found in lib/api/auth_api.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 parse_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def parse_data(response)
        return nil unless has_data?(response)
    
        begin
          json_response = JSON.parse(response.body)
    Severity: Minor
    Found in lib/api/helpers/api_helpers.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 set_err has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def set_err(response_code, json_response)
        if json_response.present?
          if json_response["error"].present?
            @error = json_response["error"]
          elsif json_response["code"].present?
    Severity: Minor
    Found in lib/api/helpers/api_helpers.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