WeAreFarmGeek/diplomat

View on GitHub

Showing 45 of 64 total issues

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

    def transaction_consistency(options)
      return [] unless options

      if options[:consistency] && options[:consistency] == 'stale'
        ['stale']
Severity: Minor
Found in lib/diplomat/kv.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 get_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all(name = nil, not_found = :reject, found = :return, options = {})
      # Event list never returns 404 or blocks, but may return an empty list
      @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))
      if JSON.parse(@raw.body).count.zero?
        case not_found
Severity: Minor
Found in lib/diplomat/event.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(value, options = {})
      id = value[:ID] || value['ID']
      raise Diplomat::IdParameterRequired if id.nil?

      policy_name = value[:Name] || value['Name']
Severity: Minor
Found in lib/diplomat/policy.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 wait_to_acquire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def wait_to_acquire(key, session, value = nil, check_interval = 10, options = {})
      acquired = false
      until acquired
        acquired = acquire(key, session, value, options)
        sleep(check_interval) unless acquired
Severity: Minor
Found in lib/diplomat/lock.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create(value = nil, options = {})
      # TODO: only certain keys are recognised in a session create request,
      # should raise an error on others.
      custom_params = []
      custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
Severity: Minor
Found in lib/diplomat/session.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