martinchristen/pyRT

View on GitHub

Showing 188 of 188 total issues

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

    def _shade(self, scene: Scene, ray: Ray, hitrecord: HitRecord) -> tuple:
        r = g = b = 0  # background color
        hit = False
        for element in scene.nodes:
            if element.hit(ray, hitrecord):
Severity: Minor
Found in pyrt/renderer/simplert.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 __getitem__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __getitem__(self, key):
        if type(key) == tuple:
            if len(key) != 2:
                raise IndexError("Index must be 2-dimensional!")
            x, y = key
Severity: Minor
Found in pyrt/math/mat4.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 snowflake has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def snowflake(image: Image, lev: int, x1: int, y1: int, x5: int, y5: int, color: Vec3) -> None:
    if lev == 0:
        image.drawLine(Vec2(x1, y1), Vec2(x5, y5), color)
    else:
        deltaX = x5 - x1
Severity: Minor
Found in examples/02_snowflake.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

TODO found
Open

        self.invdir = Vec3(1e20, 1e20, 1e20)  # TODO: make this IEEE 754 compliant
Severity: Minor
Found in pyrt/math/ray.py by fixme

TODO found
Open

    def hitShadow(self, ray: Ray) -> bool:         # TODO: This method should be renamed to "hitTest".
Severity: Minor
Found in pyrt/geometry/shape.py by fixme

TODO found
Open

        # TODO: MATERIAL
Severity: Minor
Found in pyrt/geometry/shape.py by fixme

TODO found
Open

        # TODO: use arbitrary size, currently only size 1,2 and 3 are supported...
Severity: Minor
Found in pyrt/renderer/rgbimage.py by fixme

TODO found
Open

                if type(kwargs["normal"]) == Vec3:  # TODO: a list/tuple of values is ok too...
Severity: Minor
Found in pyrt/geometry/vertex.py by fixme
Severity
Category
Status
Source
Language