phenomenal/phenomenal

View on GitHub
lib/phenomenal/manager/context_management.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

There are no issues that match your filters.

Category
Status