Asana/ruby-asana

View on GitHub

Showing 7 of 27 total issues

Method log_asana_change_headers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def log_asana_change_headers(request_headers, response_headers)
      change_header_key = nil

      response_headers.each_key do |key|
        change_header_key = key if key.downcase == 'asana-change'
Severity: Minor
Found in lib/asana/http_client.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 handle has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def handle(num_retries = 0, &request)
        request.call
      rescue Faraday::ClientError => e
        raise e unless e.response

Severity: Minor
Found in lib/asana/http_client/error_handling.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 log_asana_change_headers has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def log_asana_change_headers(request_headers, response_headers)
      change_header_key = nil

      response_headers.each_key do |key|
        change_header_key = key if key.downcase == 'asana-change'
Severity: Minor
Found in lib/asana/http_client.rb - About 1 hr to fix

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

          def each(&block)
            if block
              loop do
                poll if @events.empty?
                event = @events.shift
    Severity: Minor
    Found in lib/asana/resource_includes/events.rb - About 45 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 post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def post(resource_uri, body: {}, upload: nil, options: {})
          opts = options.reduce({}) do |acc, (k, v)|
            acc.tap do |hash|
              hash[:"opt_#{k}"] = v.is_a?(Array) ? v.join(',') : v
            end
    Severity: Minor
    Found in lib/asana/http_client.rb - About 45 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 perform_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def perform_request(method, resource_uri, body = {}, headers = {}, &request_config)
    Severity: Minor
    Found in lib/asana/http_client.rb - About 35 mins to fix

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

          def put(resource_uri, body: {}, options: {})
            opts = options.reduce({}) do |acc, (k, v)|
              acc.tap do |hash|
                hash[:"opt_#{k}"] = v.is_a?(Array) ? v.join(',') : v
              end
      Severity: Minor
      Found in lib/asana/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