danini-the-panini/mittsu-opengl

View on GitHub
lib/mittsu/opengl_implementation/materials/material.rb

Summary

Maintainability
A
2 hrs
Test Coverage
B
86%

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

    def program_parameters(lights, fog, object)
      # heuristics to create shader paramaters according to lights in the scene
      # (not to blow over max_lights budget)

      max_light_count = allocate_lights(lights)

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 program_parameters has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def program_parameters(lights, fog, object)
      # heuristics to create shader paramaters according to lights in the scene
      # (not to blow over max_lights budget)

      max_light_count = allocate_lights(lights)
Severity: Minor
Found in lib/mittsu/opengl_implementation/materials/material.rb - About 1 hr to fix

    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/opengl_implementation/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

    TODO found
    Open

        # MeshDepthMaterial => :depth, # TODO...

    TODO found
    Open

        # TODO: init_shader for these material-types

    TODO found
    Open

          # TODO: when SkinnedMesh exists

    TODO found
    Open

        # MeshNormalMaterial => :normal, # TODO...

    TODO found
    Open

            # fog_exp: fog.is_a?(FogExp2), # TODO: when FogExp2 exists

    TODO found
    Open

        # PointCloudMaterial => :particle_basic # TODO...

    TODO found
    Open

        # LineDashedMaterial => :dashed, # TODO...

    There are no issues that match your filters.

    Category
    Status