Showing 45 of 81 total issues

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

          def sound=(sound)
            if sound.is_a?(Hash)
              write_attribute(:sound, multi_json_dump(sound))
              self.sound_is_json = true if has_attribute?(:sound_is_json)
            else

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 read_loop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def read_loop(socket)
          loop do
            line = socket.gets
            break unless line

Severity: Minor
Found in lib/rpush/daemon/rpc/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

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

          def alert=(alert)
            if alert.is_a?(Hash)
              write_attribute(:alert, multi_json_dump(alert))
              self.alert_is_json = true if has_attribute?(:alert_is_json)
            else

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_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def to_xml
          launch_string = "" unless @launch
          launch_string = " launch='#{CleanParamString.clean(@launch)}'" if @launch
          audio_string = "" unless @sound
          audio_string = "<audio src='#{CleanParamString.clean(@sound)}'/>" if @sound
Severity: Minor
Found in lib/rpush/daemon/wns/toast_request.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 shutdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.shutdown
    return unless Rpush.config.embedded
    Rpush::Daemon.shutdown
    @embed_thread.join if @embed_thread
  rescue StandardError => e
Severity: Minor
Found in lib/rpush/embed.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