danini-the-panini/mittsu-opengl

View on GitHub

Showing 251 of 251 total issues

Method render_buffer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
      type = GL::UNSIGNED_INT # geometry_group.type_array == Uint32Array ? GL::UNSIGNED_INT : GL::UNSIGNED_SHORT

      # wireframe
      if material.wireframe
Severity: Minor
Found in lib/mittsu/opengl_implementation/objects/mesh.rb - About 25 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 project_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def project_object(scene, object, shadow_camera)
      if object.visible
        opengl_objects = @opengl_objects[object.id]

        if opengl_objects && object.cast_shadow && (object.frustum_culled == false || @frustum.intersects_object?(object) == true)
Severity: Minor
Found in lib/mittsu/opengl/plugins/shadow_map_plugin.rb - About 25 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 call_debug_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def call_debug_method m, called_from = caller[0], *args
      if m.to_s.start_with?('Uniform')
        uniform_name = @@current_shader.get_uniform_name(args.first)
        call = "#{m}('#{uniform_name}',#{args[1..-1].map { |s| s.to_s[0..20] }.join(', ')})"
      else
Severity: Minor
Found in lib/mittsu/opengl/gl_debug.rb - About 25 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

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_buffer(camera, lights, fog, material, geometry_group, object)
Severity: Minor
Found in lib/mittsu/opengl/renderer.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_objects_immediate(render_list, material_type, camera, lights, fog, override_material)
Severity: Minor
Found in lib/mittsu/opengl/renderer.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Unused method argument - material. If it's necessary, use _ or _material as an argument name to indicate that it won't be used.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused method argument - lights. If it's necessary, use _ or _lights as an argument name to indicate that it won't be used.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused block argument - mods. If it's necessary, use _ or _mods as an argument name to indicate that it won't be used.
Open

        @mouse_button_callback = ::GLFW::create_callback(:GLFWmousebuttonfun) do |window_handle, button, action, mods|
Severity: Minor
Found in lib/mittsu/glfw/window.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

end at 139, 12 is not aligned with case at 134, 19.
Open

            end
Severity: Minor
Found in lib/mittsu/opengl/geometry_group.rb by rubocop

This cop checks whether the end keywords are aligned properly.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

Example: EnforcedStyleAlignWith: keyword (default)

# bad

variable = if true
    end

# good

variable = if true
           end

Example: EnforcedStyleAlignWith: variable

# bad

variable = if true
    end

# good

variable = if true
end

Example: EnforcedStyleAlignWith: startofline

# bad

variable = if true
    end

# good

puts(if true
end)

Unused block argument - window_handle. If it's necessary, use _ or _window_handle as an argument name to indicate that it won't be used.
Open

        @cursor_pos_callback = ::GLFW::create_callback(:GLFWcursorposfun) do |window_handle, xpos, ypos|
Severity: Minor
Found in lib/mittsu/glfw/window.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Unused block argument - window_handle. If it's necessary, use _ or _window_handle as an argument name to indicate that it won't be used.
Open

        @scroll_callback = ::GLFW::create_callback(:GLFWscrollfun) do |window_handle, xoffset, yoffset|
Severity: Minor
Found in lib/mittsu/glfw/window.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Unused block argument - v. If it's necessary, use _ or _v as an argument name to indicate that it won't be used.
Open

      attributes.each do |k, v|
Severity: Minor
Found in lib/mittsu/opengl/program.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

end at 392, 12 is not aligned with case at 388, 23.
Open

            end
Severity: Minor
Found in lib/mittsu/opengl/renderer.rb by rubocop

This cop checks whether the end keywords are aligned properly.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

Example: EnforcedStyleAlignWith: keyword (default)

# bad

variable = if true
    end

# good

variable = if true
           end

Example: EnforcedStyleAlignWith: variable

# bad

variable = if true
    end

# good

variable = if true
end

Example: EnforcedStyleAlignWith: startofline

# bad

variable = if true
    end

# good

puts(if true
end)

Unused method argument - lights. If it's necessary, use _ or _lights as an argument name to indicate that it won't be used.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused method argument - fog. If it's necessary, use _ or _fog as an argument name to indicate that it won't be used.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused block argument - window_handle. If it's necessary, use _ or _window_handle as an argument name to indicate that it won't be used.
Open

        @mouse_button_callback = ::GLFW::create_callback(:GLFWmousebuttonfun) do |window_handle, button, action, mods|
Severity: Minor
Found in lib/mittsu/glfw/window.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Unused block argument - i. You can omit the argument if you don't care about it.
Open

            3.times do |i|
Severity: Minor
Found in lib/mittsu/opengl/geometry_group.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end
Severity
Category
Status
Source
Language