jungomi/coach_client

View on GitHub

Showing 9 of 39 total issues

Method list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.list(client, size: 20, start: 0, all: false)
      userlist = []
      if all
        total = self.total(client)
        start = 0
Severity: Minor
Found in lib/coach_client/user.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 list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.list(client, size: 20, start: 0, all: false)
      list = []
      if all
        total = self.total(client)
        start = 0
Severity: Minor
Found in lib/coach_client/partnership.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 update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update(size: 20, start: 0, all: false)
      response = {}
      if all
        start = 0
        size = @client.max_size
Severity: Minor
Found in lib/coach_client/user.rb - About 1 hr to fix

    Method update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(size: 20, start: 0, all: false)
          response = {}
          if all
            start = 0
            size = @client.max_size
    Severity: Minor
    Found in lib/coach_client/user.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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def save
          unless operational?
            propose unless @user1_confirmed
            return confirm
          end
    Severity: Minor
    Found in lib/coach_client/partnership.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(user, size: 20, start: 0, all: false)
          response = {}
          if all
            start = 0
            size = @client.max_size
    Severity: Minor
    Found in lib/coach_client/subscription.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 to_h has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_h
          hash = {}
          instance_variables.each do |var|
            next if var.to_s == '@client'
            value = instance_variable_get(var)
    Severity: Minor
    Found in lib/coach_client/resource.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def update
          fail CoachClient::NotFound.new(self), 'Entry not found' if @id.nil?
          response = CoachClient::Request.get(url, username: user.username,
                                              password: user.password)
          tag = "entry#{@subscription.sport}"
    Severity: Minor
    Found in lib/coach_client/entry.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(client, subscription, info = {})
          super(client)
          @subscription = subscription
          @id = info[:id]
          @publicvisible = info[:publicvisible]
    Severity: Minor
    Found in lib/coach_client/entry.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