Showing 58 of 188 total issues
Function load
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load(self, filename):
"""
Load 3d object from file (obj format).
(Please note that a triangle mesh is not a scene! Only single material, single meshes are imported.)
(also, the importer is really simple. Meshes must be triangulated before!!)
- Read upRead up
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 __eq__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __eq__(self, other):
if type(other) == list or type(other) == tuple: # not checking type within tuple/list
if len(other) == 3:
return (abs(self.x - other[0]) < G_EPSILON) and (abs(self.y - other[1]) < G_EPSILON) and (
abs(self.z - other[2]) < G_EPSILON)
- Read upRead up
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 testCamera
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def testCamera(self):
w=320
h=240
# Create a camere with width, height and field of view:
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, elm=None):
"""
elm:
if None this will create a matrix initialized with 0
- Read upRead up
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 __eq__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __eq__(self, other):
if type(other) == list or type(other) == tuple: # not checking type within tuple/list
if len(other) == 2:
return (abs(self.x - other[0]) < G_EPSILON) and (abs(self.y - other[1]) < G_EPSILON)
else:
- Read upRead up
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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, period=None, permutation_table=None, randint_function=None):
"""Initialize the noise generator. With no arguments, the default
period and permutation table are used (256). The default permutation
table generates the exact same noise pattern each time.
- Read upRead up
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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def snowflake(image: Image, lev: int, x1: int, y1: int, x5: int, y5: int, color: Vec3) -> None:
Function clamp4
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clamp4(v: Vec4, minVal: Vec4, maxVal: Vec4):
"""
Component-wise clamp
In case v is smaller than minVal, minVal is returned.
- Read upRead up
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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, position: Vec3, direction: Vec3, p: int, a = 0.02, b = 0.1, c = 0) -> None:
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, start: Vec3, direction: Vec3) -> None:
if type(start) != Vec3 or type(direction) != Vec3:
print("Error: start and direction must be Vec3")
return
- Read upRead up
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 createOrtho4
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def createOrtho4(left: float, right : float, bottom: float, top: float, znear: float, zfar: float) -> Mat4:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, color: Vec3 = Vec3(1., 1., 1.), shininess: float = 10.0, reflectivity: float = 0.0,
Function drawPixelFast8
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawPixelFast8(self, x: int, y: int, r: int, g: int, b: int) -> None:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, color: Vec3 = Vec3(1.,1.,1.), shininess: float = 10.0, reflectivity: float = 0.0, refraction: float = 1.0,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, color: Vec3 = Vec3(0.,0.,0.), shininess: float = 0.0, reflectivity: float = 0.5, refraction: float = 1.0, transparency = 0.0):
Function noise3
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def noise3(self, x, y, z, repeat, base=0.0):
Function setProjection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def setProjection(self, fov: float, width: int, height: int, znear: float, zfar: float):
Function drawCircleFilled
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawCircleFilled(self, center: Vec2, radius: int, color: Vec3, fillcolor: Vec3, size : int = 1):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, color: Vec3 = Vec3(1.,1.,1.), shininess: float = 10.0, reflectivity: float = 0.0, refraction: float = 1.0, transparency = 0.0):
Function hit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hit(self, ray: Ray, hitrecord: HitRecord) -> bool:
"""
Hit ray with sphere.
:param ray: the ray to check hit
- Read upRead up
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"