realtradam/FelFlame

View on GitHub

Showing 6 of 6 total issues

Method clear_triggers has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def clear_triggers(*trigger_types, component_or_manager: nil)
      trigger_types = %i[addition_triggers removal_triggers attr_triggers] if trigger_types.empty?

      if trigger_types.include? :attr_triggers
        if (trigger_types - %i[addition_triggers
Severity: Minor
Found in lib/felecs/system_manager.rb - About 4 hrs 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 clear_triggers has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def clear_triggers(*trigger_types, component_or_manager: nil)
      trigger_types = %i[addition_triggers removal_triggers attr_triggers] if trigger_types.empty?

      if trigger_types.include? :attr_triggers
        if (trigger_types - %i[addition_triggers
Severity: Minor
Found in lib/felecs/system_manager.rb - About 2 hrs to fix

    Method group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def group(*component_managers, &block)
            return nil if component_managers.empty?
    
            if component_managers.length == 1
              component_managers.first.each do |cmp|
    Severity: Minor
    Found in lib/felecs/entity_manager.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 new has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def new(component_name, *attrs, **attrs_with_defaults)
            if FelECS::Components.const_defined?(component_name)
              raise(NameError.new, "Component Manager '#{component_name}' is already defined")
            end
    
    
    Severity: Minor
    Found in lib/felecs/component_manager.rb - About 1 hr to fix

      Method group has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def group(*component_managers, &block)
              return nil if component_managers.empty?
      
              if component_managers.length == 1
                component_managers.first.each do |cmp|
      Severity: Minor
      Found in lib/felecs/entity_manager.rb - About 1 hr to fix

        Method new has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def new(component_name, *attrs, **attrs_with_defaults)
                if FelECS::Components.const_defined?(component_name)
                  raise(NameError.new, "Component Manager '#{component_name}' is already defined")
                end
        
        
        Severity: Minor
        Found in lib/felecs/component_manager.rb - About 45 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

        Severity
        Category
        Status
        Source
        Language