grocer/grocer

View on GitHub

Showing 5 of 5 total issues

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

      def deep_symbolize_keys
        result = {}
        each do |key, value|
          # Workaround for JRuby defining Fixnum#to_sym even in 1.9 mode
          # (now updated to Integer, for Ruby >= 2.4.0)
Severity: Minor
Found in lib/grocer/extensions/deep_symbolize_keys.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 with_connection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def with_connection
      attempts = 1
      begin
        connect
        yield
Severity: Minor
Found in lib/grocer/connection.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 payload_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def payload_hash
      aps_hash = { }
      aps_hash[:alert] = alert if alert
      aps_hash[:badge] = badge if badge
      aps_hash[:sound] = sound if sound
Severity: Minor
Found in lib/grocer/notification.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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def connect
      context = OpenSSL::SSL::SSLContext.new

      if certificate

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

    def accept
      Thread.new {
        begin
          @server.accept { |client|
            @clients << client
Severity: Minor
Found in lib/grocer/server.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