danini-the-panini/mittsu

View on GitHub

Showing 226 of 659 total issues

Method from_geometry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def from_geometry(geometry, settings = {})
      vertices = geometry.vertices
      faces = geometry.faces
      face_vertex_uvs = geometry.face_vertex_uvs
      vertex_colors = settings.fetch(:vertex_colors, Mittsu::NoColors)
Severity: Minor
Found in lib/mittsu/core/buffer_geometry.rb - About 1 hr 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 compute_tangents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_tangents
      # based on http://www.terathon.com/code/tangent.html
      # (per vertex tangents)

      if [:index, :position, :normal, :uv].any { |s| !@attributes.has_key?}
Severity: Minor
Found in lib/mittsu/core/buffer_geometry.rb - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(a, b, c, normal = nil, color = nil, material_index = nil)
      @a = a
      @b = b
      @c = c
      @normal = normal.is_a?(Vector3) ? normal : Mittsu::Vector3.new
Severity: Minor
Found in lib/mittsu/core/face3.rb - About 1 hr 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 reorder_buffers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def reorder_buffers(index_buffer, index_map, vertex_count)
      # Create a copy of all attributes for reordering
      sorted_attributes = {}
      @attributes.each do |key, attribute|
        next if key == :index
Severity: Minor
Found in lib/mittsu/core/buffer_geometry.rb - About 1 hr 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 init_geometry_groups has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def init_geometry_groups(object)
      material = object.material
      add_buffers = false

      if @groups.nil? || @groups_need_update
Severity: Minor
Found in lib/mittsu/renderers/opengl/core/geometry.rb - About 1 hr to fix

    Method intersect_triangle has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def intersect_triangle(a, b, c, backface_culling, target = Mittsu::Vector3.new)
          # Compute the offset origin, edges, and normal.
          diff = Mittsu::Vector3.new
          edge1 = Mittsu::Vector3.new
          edge2 = Mittsu::Vector3.new
    Severity: Minor
    Found in lib/mittsu/math/ray.rb - About 1 hr to fix

      Method convert has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def convert(materials_info)
              return materials_info if !@options
      
              converted = {}
      
      
      Severity: Minor
      Found in lib/mittsu/loaders/mtl_loader.rb - About 1 hr to fix

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

            def initialize
              super
        
              @id = (@@id ||= 1).tap { @@id += 1 }
        
        
        Severity: Minor
        Found in lib/mittsu/core/geometry.rb - About 1 hr to fix

          Method parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def parse(text)
                lines = text.split("\n")
                info = {}
                delimiter_pattern = /\s+/
                materials_info = {}
          Severity: Minor
          Found in lib/mittsu/loaders/mtl_loader.rb - About 1 hr to fix

            Method initialize has 8 arguments (exceeds 4 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))
            Severity: Major
            Found in lib/mittsu/extras/geometries/cylinder_geometry.rb - About 1 hr to fix

              Method build_plane has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def build_plane(u, v, udir, vdir, width, height, depth, material_index)
              Severity: Major
              Found in lib/mittsu/extras/geometries/box_geometry.rb - About 1 hr to fix

                Method init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def init
                      if !@initted
                        puts " --- INIT #{self.name}" if DEBUG
                
                        @initted = true
                Severity: Minor
                Found in lib/mittsu/renderers/opengl/core/object_3d.rb - About 55 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

                Method intersect_triangle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def intersect_triangle(a, b, c, backface_culling, target = Mittsu::Vector3.new)
                      # Compute the offset origin, edges, and normal.
                      diff = Mittsu::Vector3.new
                      edge1 = Mittsu::Vector3.new
                      edge2 = Mittsu::Vector3.new
                Severity: Minor
                Found in lib/mittsu/math/ray.rb - About 55 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

                Method fire_joystick_button_event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def fire_joystick_button_event(joystick, button, pressed)
                        if !@joystick_buttons[joystick][button] && pressed
                          @joystick_button_press_handler.call(joystick, button) unless @joystick_button_press_handler.nil?
                        elsif @joystick_buttons[joystick][button] && !pressed
                          @joystick_button_release_handler.call(joystick, button) unless @joystick_button_release_handler.nil?
                Severity: Minor
                Found in lib/mittsu/renderers/glfw_window.rb - About 55 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

                Method allocate_shadows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def allocate_shadows(lights)
                      max_shadows = 0
                
                      lights.each do |light|
                        next unless light.cast_shadow
                Severity: Minor
                Found in lib/mittsu/renderers/opengl/materials/material.rb - About 55 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

                Method print_tree has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def print_tree(lines=[])
                      if lines.empty?
                        puts self
                      else
                        last = !lines.last
                Severity: Minor
                Found in lib/mittsu/core/object_3d.rb - About 55 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

                Method create_material has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                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 - About 55 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

                Method load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def load(url, mtlurl = nil)
                      object = OBJLoader.new(@manager).load(url)
                
                      if !mtlurl.nil?
                        mtl_loader = MTLLoader.new(File.dirname(url))
                Severity: Minor
                Found in lib/mittsu/loaders/obj_mtl_loader.rb - About 55 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

                Method check_intersection has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def check_intersection object, raycaster, ray, pA, pB, pC, point
                Severity: Major
                Found in lib/mittsu/objects/mesh.rb - About 50 mins to fix

                  Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def initialize(radius = 50.0, width_segments = 8, height_segments = 6, phi_start = 0.0, phi_length = (::Math::PI * 2.0), theta_start = 0.0, theta_length = ::Math::PI)
                  Severity: Major
                  Found in lib/mittsu/extras/geometries/sphere_geometry.rb - About 50 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language