matthewstyler/ruby-perlin-2D-map-generator

View on GitHub

Showing 8 of 15 total issues

Method retrieve_points has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def retrieve_points(active_list, points, num_of_points, radius)
      return if active_list.empty?

      current_point, active_index = retreive_current_point(active_list)
      found = false
Severity: Minor
Found in lib/poisson_disk_sampling/sampler.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 neighbours_empty? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def neighbours_empty?(new_point, radius)
      cell_empty = true
      (-radius..radius).each do |dy|
        (-radius..radius).each do |dx|
          x = new_point.x + dx
Severity: Minor
Found in lib/poisson_disk_sampling/sampler.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 neighbors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def neighbors(node)
      neighbors = []
      return neighbors unless node.can_haz_road?

      x = node.x
Severity: Minor
Found in lib/pathfinding/grid.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 find_path has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def find_path(start_node, end_node, grid)
      came_from = {}
      g_score = { start_node => 0 }
      f_score = { start_node => manhattan_distance(start_node, end_node) }

Severity: Minor
Found in lib/pathfinding/a_star_finder.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 generate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def generate(config)
    return unless config.generate_flora

    puts 'generating flora...' if config.verbose
    tiles.each do |row|
Severity: Minor
Found in lib/flora_generator.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 find_minimum_edge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def find_minimum_edge(distances, visited)
    # method to find the minimum edge connecting visited and unvisited nodes
    min_edge = nil
    min_distance = Float::INFINITY

Severity: Minor
Found in lib/town_generator.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 generate_town has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def generate_town(town_num, num_of_points, radius, initial_coords, verbose)
Severity: Minor
Found in lib/town_generator.rb - About 35 mins to fix

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

        def heapify_down(index)
          left_child_index = 2 * index + 1
          right_child_index = 2 * index + 2
          smallest = index
    
    
    Severity: Minor
    Found in lib/pathfinding/priority_queue.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