danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Method set has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def set(slot, renderer)
      @renderer = renderer

      if image.length == 6
        if needs_update?
Severity: Major
Found in lib/mittsu/renderers/opengl/textures/cube_texture.rb - About 2 hrs to fix

    Method init_mesh_buffers has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def init_mesh_buffers(object)
          geometry = object.geometry
    
          nvertices = @faces3.length * 3
          nvertices2 = nvertices * 2
    Severity: Minor
    Found in lib/mittsu/renderers/opengl/opengl_geometry_group.rb - About 2 hrs 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 initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (::Math::PI * 2.0))
          super()
    
          @type = 'CylinderGeometry'
    
    
    Severity: Minor
    Found in lib/mittsu/extras/geometries/cylinder_geometry.rb - About 2 hrs 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

    Cyclomatic complexity for create_material is too high. [11/6]
    Open

          def create_material(material_name)
            mat = @materials_info[material_name]
            params = {
              name: material_name,
              side: @side
    Severity: Minor
    Found in lib/mittsu/loaders/mtl_loader.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Method has too many lines. [35/30]
    Open

          def create_material(material_name)
            mat = @materials_info[material_name]
            params = {
              name: material_name,
              side: @side
    Severity: Minor
    Found in lib/mittsu/loaders/mtl_loader.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for update is too high. [11/6]
    Open

        def update
          # check all geometry groubs
          mat = nil
          geometry.groups.each do |geometry_group|
            # TODO: place to put this???

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Method has too many lines. [35/30]
    Open

        def inverse(m, throw_on_invertable = false)
          # based on http:#www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
          te = @elements
          me = m.elements
          n11 = me[0]; n12 = me[4]; n13 = me[8];  n14 = me[12]
    Severity: Minor
    Found in lib/mittsu/math/matrix4.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method initialize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def initialize(func, slices, stacks)
          super()
    
          @type = 'ParametricBufferGeometry'
    
    
    Severity: Major
    Found in lib/mittsu/extras/geometries/parametric_buffer_geometry.rb - About 2 hrs to fix

      Method initialize has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(width, height, width_segments = 1, height_segments = 1)
            super()
      
            @type = 'PlaneBufferGeometry'
      
      
      Severity: Major
      Found in lib/mittsu/extras/geometries/plane_buffer_geometry.rb - About 2 hrs to fix

        Method initialize has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def initialize(width, height, title, antialias: 0)
                ::GLFW.Init
        
                ::GLFW.WindowHint ::GLFW::OPENGL_PROFILE, ::GLFW::OPENGL_CORE_PROFILE
                ::GLFW.WindowHint ::GLFW::OPENGL_FORWARD_COMPAT, GL::TRUE
        Severity: Major
        Found in lib/mittsu/renderers/glfw_window.rb - About 2 hrs to fix

          Class Geometry has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Geometry
              include EventDispatcher
          
              MorphNormal = Struct.new(:face_normals, :vertex_normals)
              Normal = Struct.new(:a, :b, :c)
          Severity: Minor
          Found in lib/mittsu/core/geometry.rb - About 2 hrs to fix

            Class BufferGeometry has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class BufferGeometry
                include EventDispatcher
            
                DrawCall = Struct.new(:start, :count, :index)
            
            
            Severity: Minor
            Found in lib/mittsu/core/buffer_geometry.rb - About 2 hrs to fix

              Cyclomatic complexity for render_buffer is too high. [10/6]
              Open

                  def render_buffer(camera, lights, fog, material, geometry_group, object)
                    puts "--- RENDER #{object.name}" if DEBUG
                    return unless material.visible
              
                    geometry_group.renderer = self

              This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

              An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

              Method has too many lines. [34/30]
              Open

                  def initialize(radius = 1.0, detail = 0)
                    t = (1.0 + ::Math.sqrt(5.0)) / 2.0
                    r = 1.0 / t
              
                    vertices = [

              This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

              Cyclomatic complexity for set_line_buffers is too high. [10/6]
              Open

                  def set_line_buffers(hint)
                    if @vertices_need_update
                      @vertices.each_with_index do |vertex, v|
                        offset = v * 3
              
              

              This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

              An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

              Cyclomatic complexity for parse is too high. [10/6]
              Open

                  def parse(text)
                    lines = text.split("\n")
                    info = {}
                    delimiter_pattern = /\s+/
                    materials_info = {}
              Severity: Minor
              Found in lib/mittsu/loaders/mtl_loader.rb by rubocop

              This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

              An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

              Method build_plane has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def build_plane(u, v, udir, vdir, width, height, depth, material_index)
                    grid_x = @width_segments
                    grid_y = @height_segments
                    width_half = width / 2.0
                    height_half = height / 2.0
              Severity: Major
              Found in lib/mittsu/extras/geometries/box_geometry.rb - About 2 hrs to fix

                Method render_objects_immediate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def render_objects_immediate(render_list, material_type, camera, lights, fog, override_material)
                      material = nil
                      render_list.each do |opengl_object|
                        object = opengl_object.object
                        if object.visible
                Severity: Minor
                Found in lib/mittsu/renderers/opengl_renderer.rb - About 2 hrs 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 render_objects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def render_objects(render_list, camera, lights, fog, override_material)
                      material = nil
                      render_list.each do |opengl_object|
                        puts "-- RENDER_OBJECT #{opengl_object.name}" if DEBUG
                        object = opengl_object.object
                Severity: Minor
                Found in lib/mittsu/renderers/opengl_renderer.rb - About 2 hrs 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 intersect_box has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def intersect_box(box, target = Mittsu::Vector3.new)
                      # http:#www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/
                      invdirx = 1.0 / @direction.x
                      invdiry = 1.0 / @direction.y
                      invdirz = 1.0 / @direction.z
                Severity: Minor
                Found in lib/mittsu/math/ray.rb - About 2 hrs 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