danini-the-panini/mittsu

View on GitHub

Showing 226 of 659 total issues

Method merge_vertices has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def merge_vertices
      vertices_map = {} # Hashmap for looking up vertice by position coordinates (and making sure they are unique)
      unique = []; changes = []
      precision_points = 4 # number of decimal points, eg. 4 for epsilon of 0.0001
      precision = 10 ** precision_points
Severity: Minor
Found in lib/mittsu/core/geometry.rb - About 1 hr to fix

    Method unroll_buffer_material has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def unroll_buffer_material(opengl_object)
          object = opengl_object.object
          buffer = opengl_object.buffer
    
          geometry = object.geometry
    Severity: Minor
    Found in lib/mittsu/renderers/opengl_renderer.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 set_line_buffers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_line_buffers(hint)
          if @vertices_need_update
            @vertices.each_with_index do |vertex, v|
              offset = v * 3
    
    
    Severity: Minor
    Found in lib/mittsu/renderers/opengl/core/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 build_plane has a Cognitive Complexity of 12 (exceeds 5 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: Minor
    Found in lib/mittsu/extras/geometries/box_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 make_groups has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_groups(uses_face_material = false)
          max_vertices_in_group = 65535 # TODO: OES_element_index_uint ???
    
          hash_map = {}
    
    
    Severity: Minor
    Found in lib/mittsu/renderers/opengl/core/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 update_shadow_camera has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_shadow_camera(camera, light)
          shadow_camera = light.shadow_camera
          points_frustum = light.pointa_frustum
          points_world = light.points_world
    
    
    Severity: Minor
    Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.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 set_values has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_values(values = nil)
          return if values.nil?
    
          values.each do |(key, new_value)|
            if new_value.nil?
    Severity: Minor
    Found in lib/mittsu/materials/material.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 hsl has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def hsl(target = nil)
          # h,s,l ranges are in 0.0 - 1.0
          hsl = target || { h: 0.0, s: 0.0, l: 0.0 }
          rr, gg, bb = self.r, self.g, self.b
          max = [r, g, b].max
    Severity: Minor
    Found in lib/mittsu/math/color.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_morph_normals has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute_morph_normals
          # save original normals
          # - create temp variables on first access
          #   otherwise just copy (for faster repeated calls)
          @_original_face_normal ||= []
    Severity: Minor
    Found in lib/mittsu/core/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 inverse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    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 - About 1 hr to fix

      Method create_material has 35 lines of code (exceeds 25 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 1 hr to fix

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

            def initialize(mipmaps = nil, width = nil, height = nil, format = RGBAFormat, type = UnsignedByteType, mapping = DEFAULT_MAPPING, wrap_s = ClampToEdgeWrapping, wrap_t = ClampToEdgeWrapping, mag_filter = LinearFilter, min_filter = LinearMipMapLinearFilter, anisotropy = 1)
        Severity: Major
        Found in lib/mittsu/textures/compressed_texture.rb - About 1 hr to fix

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

              def initialize(data = nil, width = nil, height = nil, format = RGBAFormat, type = UnsignedByteType, mapping = DEFAULT_MAPPING, wrap_s = ClampToEdgeWrapping, wrap_t = ClampToEdgeWrapping, mag_filter = LinearFilter, min_filter = LinearMipMapLinearFilter, anisotropy = 1)
          Severity: Major
          Found in lib/mittsu/textures/data_texture.rb - About 1 hr to fix

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

                def initialize(radius = 1.0, detail = 0)
                  t = (1.0 + ::Math.sqrt(5.0)) / 2.0
                  r = 1.0 / t
            
                  vertices = [
            Severity: Minor
            Found in lib/mittsu/extras/geometries/dodecahedron_geometry.rb - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if geometry.vertices_need_update || geometry.morph_targets_need_update || geometry.elements_need_update || geometry.uvs_need_update || geometry.normals_need_update || geometry.colors_need_update || geometry.tangents_need_update || custom_attributes_dirty
                        geometry_group.set_mesh_buffers(self, GL::DYNAMIC_DRAW, !geometry.dynamic, mat)
                      end
              Severity: Critical
              Found in lib/mittsu/renderers/opengl/objects/mesh.rb - About 1 hr to fix

                Method create_virtual_light has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def create_virtual_light(light, cascade)
                      DirectionalLight.new.tap do |virtual_light|
                        virtual_light.is_virtual = true
                
                        virtual_light.only_shadow = true
                Severity: Minor
                Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 1 hr to fix

                  Method to_json has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def to_json
                        output = {
                          metadata: {
                            version: 4.0,
                            type: 'BufferGeometry',
                  Severity: Minor
                  Found in lib/mittsu/core/buffer_geometry.rb - About 1 hr to fix

                    Method intersect_box has 33 lines of code (exceeds 25 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 1 hr to fix

                      Method create_texture has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def create_texture(where, name, source_file, repeat, offset, wrap, anisotropy)
                            full_path = File.join(texture_path, source_file)
                      
                            loader = Handlers.get(full_path)
                      
                      
                      Severity: Minor
                      Found in lib/mittsu/loaders/loader.rb - About 1 hr to fix

                        Method set_from_rotation_matrix has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def set_from_rotation_matrix(m)
                              # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
                              # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
                              te = m.elements
                              m11 = te[0]; m12 = te[4]; m13 = te[8]
                        Severity: Minor
                        Found in lib/mittsu/math/quaternion.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language