awkisopen/australium

View on GitHub

Showing 9 of 11 total issues

Method initialize_clone has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize_clone(other)
    super
    self.each_pair do |key, value|
      if value.is_a?(OpenStruct)
        self[key] = value.clone
Severity: Minor
Found in lib/australium/ref/open_struct_deep_clone.rb - About 2 hrs 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_line has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_line(line, line_number, state = nil)
      Event::event_classes.each do |event_class|
        next unless defined?(event_class::LOG_REGEX)
        if event_class::LOG_REGEX =~ line
          # Get timestamp data & timestamp GameState if we are being stateful
Severity: Minor
Found in lib/australium/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 hash_to_obj has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def hash_to_obj(hash)
      hash.each_pair do |key, value|
        hash[key] = hash_to_obj(value) if value.is_a?(Hash)
        hash[key] = value.map { |x| hash_to_obj(x) if x.is_a?(Hash) } if value.is_a?(Array)
      end
Severity: Minor
Found in lib/australium/cache/event_cache.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 obj_to_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def obj_to_hash(obj)
      obj.each_pair do |key, value|
        obj[key] = obj_to_hash(value) if value.is_a?(OpenStruct)
        obj[key] = value.map { |x| obj_to_hash(x) if x.is_a?(OpenStruct) } if value.is_a?(Array)
      end
Severity: Minor
Found in lib/australium/cache/event_cache.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 store has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def store(game)

      # If a MapLoad event exists with identical parameters for everything except the game hash, delete the previous
      # game data - as this indicates an invalid or incomplete log was stored.
      start_event = game.map_loads.first
Severity: Minor
Found in lib/australium/cache/event_cache.rb - About 1 hr to fix

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

        def initialize(data)
          super(data)
    
          # Replace anything matching a Player string with a Player object.
          self.each_pair do |key, value|
    Severity: Minor
    Found in lib/australium/event.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(data)
          super(data)
    
          unless self.state.nil? || self.state.players.nil?
            self.state.players.each do |player|
    Severity: Minor
    Found in lib/australium/events/game_end.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 store has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def store(game)
    
          # If a MapLoad event exists with identical parameters for everything except the game hash, delete the previous
          # game data - as this indicates an invalid or incomplete log was stored.
          start_event = game.map_loads.first
    Severity: Minor
    Found in lib/australium/cache/event_cache.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 parse_game_log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.parse_game_log(lines, properties = {})
          state = GameState.new
          state.game_id = game_log_digest(lines)
          events = []
    
    
    Severity: Minor
    Found in lib/australium/parser.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

    Severity
    Category
    Status
    Source
    Language