tobspr/RenderPipeline

View on GitHub
rpcore/pynative/shadow_atlas.py

Summary

Maintainability
A
50 mins
Test Coverage

Function find_and_reserve_region has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_and_reserve_region(self, tile_width, tile_height):
        for x in range(self._num_tiles - tile_height + 1):
            for y in range(self._num_tiles - tile_width + 1):
                if self.region_is_free(x, y, tile_width, tile_height):
                    self.reserve_region(x, y, tile_width, tile_height)
Severity: Minor
Found in rpcore/pynative/shadow_atlas.py - 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

Function region_is_free has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def region_is_free(self, x, y, w, h):
        for x_offset in range(w):
            for y_offset in range(h):
                if self._flags[x + x_offset][y + y_offset]:
                    return False
Severity: Minor
Found in rpcore/pynative/shadow_atlas.py - 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

There are no issues that match your filters.

Category
Status