AndyObtiva/glimmer-dsl-libui

View on GitHub
lib/glimmer/libui/shape.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Shape has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Shape
      class << self
        def exists?(keyword)
          keyword = KEYWORD_ALIASES[keyword] || keyword
          Shape.constants.include?(constant_symbol(keyword)) and
Severity: Minor
Found in lib/glimmer/libui/shape.rb - About 5 hrs to fix

    File shape.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'glimmer/libui/parent'
    require 'glimmer/libui/control_proxy/area_proxy'
    require 'glimmer/libui/control_proxy/path_proxy'
    require 'glimmer/libui/data_bindable'
    require 'glimmer/libui/perfect_shaped'
    Severity: Minor
    Found in lib/glimmer/libui/shape.rb - About 2 hrs to fix

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

            def method_missing(method_name, *args, &block)
              method_name_parameter = method_name.to_s.sub(/=$/, '').sub(/^set_/, '').to_sym
              if self.class.parameters.include?(method_name_parameter)
                method_name = method_name.to_s
                parameter_index = self.class.parameters.index(method_name_parameter)
      Severity: Minor
      Found in lib/glimmer/libui/shape.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 absolute_point_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def absolute_point_array
              # TODO Consider moving this method into a module mixed into all shapes having point_array
              return unless respond_to?(:point_array)
              
              point_array = self.point_array || []
      Severity: Minor
      Found in lib/glimmer/libui/shape.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

      There are no issues that match your filters.

      Category
      Status