theckman/rmuh

View on GitHub

Showing 4 of 4 total issues

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

          def regex_matches(loglines)
            regexes = [[LEFT, :disconnect], [CHAT, :chat], [JOINED, :connect],
                       [GUID, :beguid]]
            loglines.map do |l|
              line = nil
Severity: Minor
Found in lib/rmuh/rpt/log/parsers/unitedoperationslog.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def parse(loglines)
            unless loglines.is_a?(Array)
              fail ArgumentError, 'argument 1 must be an Array object'
            end

Severity: Minor
Found in lib/rmuh/rpt/log/parsers/unitedoperationsrpt.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 validate_opts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.validate_opts(opts)
        fail ArgumentError, ':host is required' unless opts.key?(:host)
        opts[:port] ||= DEFAULT_PORT
        opts[:cache] = true unless opts.key?(:cache)
        opts[:auto_cache] = true unless opts.key?(:auto_cache)
Severity: Minor
Found in lib/rmuh/serverstats/base.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 regex_match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def regex_match(l)
            if ANNOUNCEMENT.match(l)
              line = { type: :announcement }.merge(m_to_h($LAST_MATCH_INFO))
            elsif WOUNDED.match(l)
              line = { type: :wounded }.merge(m_to_h($LAST_MATCH_INFO))
Severity: Minor
Found in lib/rmuh/rpt/log/parsers/unitedoperationsrpt.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