dashofcode/tracker_api

View on GitHub

Showing 6 of 22 total issues

Method paginate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def paginate(path, options = {}, &block)
      opts           = parse_query_and_convenience_headers path, options.dup
      auto_paginate  = opts[:params].delete(:auto_paginate) { |k| @auto_paginate }
      @last_response = request :get, opts
      data           = @last_response.body
Severity: Minor
Found in lib/tracker_api/client.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 add_owner has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_owner(owner)
        owner_id = if owner.kind_of?(Integer)
          owner_id = owner
        else
          raise ArgumentError, 'Valid Person expected.' unless owner.instance_of?(Resources::Person)
Severity: Minor
Found in lib/tracker_api/resources/story.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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def request(method, options = {})
      url     = options.fetch(:url)
      params  = options[:params] || {}
      body    = options[:body]
      headers = options[:headers]
Severity: Minor
Found in lib/tracker_api/client.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get(project_id, story_id: nil, epic_id: nil, params: {})
        raise ArgumentError, 'One of story id or epic id must be provided.' if story_id.nil? && epic_id.nil?

        comment_target_slug = !story_id.nil? ? "stories/#{story_id}" : "epics/#{epic_id}"

Severity: Minor
Found in lib/tracker_api/endpoints/comments.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def update(comment, params={})
        raise ArgumentError, 'Valid comment required to update.' unless comment.instance_of?(Resources::Comment)

        comment_target_slug = !comment.story_id.nil? ? "stories/#{comment.story_id}" : "epics/#{comment.epic_id}"

Severity: Minor
Found in lib/tracker_api/endpoints/comment.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 iterations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def iterations(params={})
        if params.include?(:number)
          number = params[:number].to_i
          raise ArgumentError, ':number must be > 0' unless number > 0

Severity: Minor
Found in lib/tracker_api/resources/project.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