danini-the-panini/mittsu-opengl

View on GitHub
lib/mittsu/opengl_implementation/objects/line.rb

Summary

Maintainability
A
45 mins
Test Coverage
A
100%

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

    def update
      # TODO: GL.BindVertexArray ???
      material = buffer_material(geometry)
      custom_attributes_dirty = material.attributes && material.custom_attributes_dirty?

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 render_buffer has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
Severity: Minor
Found in lib/mittsu/opengl_implementation/objects/line.rb - About 45 mins to fix

    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.

    TODO found
    Open

          # TODO: GL.BindVertexArray ???

    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 - camera. If it's necessary, use _ or _camera 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 method argument - update_buffers. If it's necessary, use _ or _update_buffers 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

    There are no issues that match your filters.

    Category
    Status