arax/onesnooper-server

View on GitHub

Showing 7 of 7 total issues

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

  def self.analyze(payload, subpayload = false)
    ::OnesnooperServer::Log.debug "[#{self.name}] Scanning decoded #{subpayload ? 'sub-' : '' }payload #{payload.inspect}"
    return {} if payload.blank?

    scanned_payload = {}
Severity: Minor
Found in lib/onesnooper_server/payload_parser.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 data_in_vm_groups has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def data_in_vm_groups(timestamp, data)
    data_ary = []

    data['VM'].each do |vm_on_host|
      next if vm_on_host.blank?
Severity: Minor
Found in lib/onesnooper_server/sql_store.rb - About 1 hr to fix

    Method analyze has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.analyze(payload, subpayload = false)
        ::OnesnooperServer::Log.debug "[#{self.name}] Scanning decoded #{subpayload ? 'sub-' : '' }payload #{payload.inspect}"
        return {} if payload.blank?
    
        scanned_payload = {}
    Severity: Minor
    Found in lib/onesnooper_server/payload_parser.rb - About 1 hr to fix

      Method data_in_vm_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def data_in_vm_groups(timestamp, data)
          data_ary = []
      
          data['VM'].each do |vm_on_host|
            next if vm_on_host.blank?
      Severity: Minor
      Found in lib/onesnooper_server/sql_store.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(log_dev, log_prefix = '[onesnooper-server]')
          if log_dev.kind_of? ::Logger
            @logger = log_dev
          else
            @logger = ::Logger.new(log_dev)
      Severity: Minor
      Found in lib/onesnooper_server/log.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.parse(monitoring_datagram, source_ip, source_port, store_instances)
          unless valid_data?(monitoring_datagram)
            ::OnesnooperServer::Log.error "[#{self.name}] Dropping invalid monitoring data #{monitoring_datagram.inspect}"
            return DATAGRAMS.default.new
          end
      Severity: Minor
      Found in lib/onesnooper_server/request_handler.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 analyze_simple_pair has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.analyze_simple_pair(key_value, parsed, regexp, suspected_complex = false)
          matched = key_value.match(regexp)
          if matched
            ::OnesnooperServer::Log.debug "[#{self.name}] Matched #{key_value.inspect} " \
                                          "as #{matched[:key].inspect} and #{matched[:value].inspect}"
      Severity: Minor
      Found in lib/onesnooper_server/payload_parser.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