phenomenal/phenomenal

View on GitHub

Showing 13 of 13 total issues

Method included has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.included(klass)
    klass.class_eval do
      # Define context with adaptations
      def phen_context(context,*contexts,&block)
        Phenomenal::Context.create(false,nil,context,*contexts,&block)
Severity: Major
Found in lib/phenomenal/dsl.rb - About 2 hrs to fix

    Class Context has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Phenomenal::Context
      extend Phenomenal::ContextCreation
      include Phenomenal::ContextRelationships
      
      @@total_activations = 0
    Severity: Minor
    Found in lib/phenomenal/context/context.rb - About 2 hrs to fix

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

        def generate()
          str=""
          offset="  "
          self.manager.contexts.each do |key,context|
            if context.is_a?(Phenomenal::Feature)
      Severity: Minor
      Found in lib/phenomenal/viewer/textual.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 find_combined_context has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def find_combined_context(contexts)
          list=Array.new
          contexts.each do |c|
            # Use the object instance if already available
            # otherwise use the symbol name
      Severity: Minor
      Found in lib/phenomenal/manager/context_management.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 create_combined_context has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_combined_context(manager,contexts,nested,closest_feature)
          context = self.new
          context.parent=closest_feature # Set parent
          instances = Array.new
          first = contexts.first
      Severity: Minor
      Found in lib/phenomenal/context/context_creation.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

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

        def activate_combined_contexts(context)
          if shared_contexts[context]
            shared_contexts[context].each do |combined_context|
              need_activation=true
              combined_contexts[combined_context].each do |shared_context|
      Severity: Minor
      Found in lib/phenomenal/manager/context_management.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

      Method add_adaptation has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def add_adaptation(klass, method_name,instance,umeth=nil, &implementation)
      Severity: Minor
      Found in lib/phenomenal/context/context.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def initialize(context,klass, method_name,instance_adapatation,implementation)
        Severity: Minor
        Found in lib/phenomenal/context/adaptation.rb - About 35 mins to fix

          Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def create(nested,closest_feature,context,*contexts,&block)
          Severity: Minor
          Found in lib/phenomenal/context/context_creation.rb - About 35 mins to fix

            Method add_node_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def add_node_for(context)
                # The default feature is the first to be added to the main graph
                if feature_nodes[context.parent_feature].nil? && context==manager.default_feature 
                  current_graph=main_graph
                # Always add the parent_feature before the contexts inside
            Severity: Minor
            Found in lib/phenomenal/viewer/graphical.rb - About 35 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 set_edge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_edge(context,edge,relationship)
                # Define edge label
                if context!=manager.default_feature
                  edge[:label]=context.to_s
                 end
            Severity: Minor
            Found in lib/phenomenal/viewer/graphical.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 find_simple_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def find_simple_context(context)
                find=nil
                if !context.kind_of?(Phenomenal::Context)
                  a = contexts.find{|k,v| v.name==context}
                  if a
            Severity: Minor
            Found in lib/phenomenal/manager/context_management.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 priority_conflict_policy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def priority_conflict_policy(context1, context2)
                  if context1.priority && !context2.priority
                    -1
                  elsif context2.priority && !context1.priority
                    1
            Severity: Minor
            Found in lib/phenomenal/manager/conflict_policies.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

            Severity
            Category
            Status
            Source
            Language