martinchristen/pyRT

View on GitHub

Showing 188 of 188 total issues

Similar blocks of code found in 7 locations. Consider refactoring.
Open

            if "w" in kwargs:
                self.w = float(kwargs["w"])
            else:
                self.w = 1.0
Severity: Major
Found in pyrt/math/vec4.py and 6 other locations - About 45 mins to fix
pyrt/math/vec3.py on lines 56..59
pyrt/math/vec3.py on lines 61..64
pyrt/math/vec3.py on lines 66..69
pyrt/math/vec4.py on lines 72..75
pyrt/math/vec4.py on lines 77..80
pyrt/math/vec4.py on lines 82..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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:
Severity: Minor
Found in pyrt/light/spotlight.py - About 45 mins to fix

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                if "z" in kwargs:
                    self.z = float(kwargs["z"])
                else:
                    self.z = 0
    Severity: Major
    Found in pyrt/math/vec4.py and 6 other locations - About 45 mins to fix
    pyrt/math/vec3.py on lines 56..59
    pyrt/math/vec3.py on lines 61..64
    pyrt/math/vec3.py on lines 66..69
    pyrt/math/vec4.py on lines 72..75
    pyrt/math/vec4.py on lines 77..80
    pyrt/math/vec4.py on lines 87..90

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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
    
    
    Severity: Minor
    Found in pyrt/math/ray.py - 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

    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,
    Severity: Minor
    Found in pyrt/material/normalmappedmaterial.py - About 45 mins to fix

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  if "y" in kwargs:
                      self.y = float(kwargs["y"])
                  else:
                      self.y = 0
      Severity: Major
      Found in pyrt/math/vec3.py and 6 other locations - About 45 mins to fix
      pyrt/math/vec3.py on lines 56..59
      pyrt/math/vec3.py on lines 66..69
      pyrt/math/vec4.py on lines 72..75
      pyrt/math/vec4.py on lines 77..80
      pyrt/math/vec4.py on lines 82..85
      pyrt/math/vec4.py on lines 87..90

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  if "y" in kwargs:
                      self.y = float(kwargs["y"])
                  else:
                      self.y = 0
      Severity: Major
      Found in pyrt/math/vec4.py and 6 other locations - About 45 mins to fix
      pyrt/math/vec3.py on lines 56..59
      pyrt/math/vec3.py on lines 61..64
      pyrt/math/vec3.py on lines 66..69
      pyrt/math/vec4.py on lines 72..75
      pyrt/math/vec4.py on lines 82..85
      pyrt/math/vec4.py on lines 87..90

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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.
      Severity: Minor
      Found in pyrt/math/vecops.py - 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

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  if "z" in kwargs:
                      self.z = float(kwargs["z"])
                  else:
                      self.z = 0
      Severity: Major
      Found in pyrt/math/vec3.py and 6 other locations - About 45 mins to fix
      pyrt/math/vec3.py on lines 56..59
      pyrt/math/vec3.py on lines 61..64
      pyrt/math/vec4.py on lines 72..75
      pyrt/math/vec4.py on lines 77..80
      pyrt/math/vec4.py on lines 82..85
      pyrt/math/vec4.py on lines 87..90

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

                  if "x" in kwargs:
                      self.x = float(kwargs["x"])
                  else:
                      self.x = 0
      Severity: Major
      Found in pyrt/math/vec4.py and 6 other locations - About 45 mins to fix
      pyrt/math/vec3.py on lines 56..59
      pyrt/math/vec3.py on lines 61..64
      pyrt/math/vec3.py on lines 66..69
      pyrt/math/vec4.py on lines 77..80
      pyrt/math/vec4.py on lines 82..85
      pyrt/math/vec4.py on lines 87..90

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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:
      Severity: Minor
      Found in pyrt/math/matops.py - About 45 mins to fix

        Similar blocks of code found in 7 locations. Consider refactoring.
        Open

                    if "x" in kwargs:
                        self.x = float(kwargs["x"])
                    else:
                        self.x = 0
        Severity: Major
        Found in pyrt/math/vec3.py and 6 other locations - About 45 mins to fix
        pyrt/math/vec3.py on lines 61..64
        pyrt/math/vec3.py on lines 66..69
        pyrt/math/vec4.py on lines 72..75
        pyrt/math/vec4.py on lines 77..80
        pyrt/math/vec4.py on lines 82..85
        pyrt/math/vec4.py on lines 87..90

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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:
        Severity: Minor
        Found in pyrt/renderer/rgbimage.py - About 35 mins to fix

          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,
          Severity: Minor
          Found in pyrt/material/texturematerial.py - About 35 mins to fix

            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):
            Severity: Minor
            Found in pyrt/renderer/rgbimage.py - About 35 mins to fix

              Function setProjection has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def setProjection(self, fov: float, width: int, height: int, znear: float, zfar: float):
              Severity: Minor
              Found in pyrt/camera/perspectivecamera.py - About 35 mins to fix

                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):
                Severity: Minor
                Found in pyrt/material/phongmaterial.py - About 35 mins to fix

                  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):
                  Severity: Minor
                  Found in pyrt/material/material.py - About 35 mins to fix

                    Function noise3 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def noise3(self, x, y, z, repeat, base=0.0):
                    Severity: Minor
                    Found in pyrt/math/perlin.py - About 35 mins to fix

                      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
                      Severity: Minor
                      Found in pyrt/geometry/sphere.py - 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