Showing 7 of 7 total issues
Method evaluate_block
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_block(node,block_context=@context)
call = node.method.first
content_runtime = create_child_runtime(node.contents)
alternate_runtime = create_child_runtime(node.alternate) if node.respond_to? :alternate
block_runtime = BlockRuntime.new(block_context,content_runtime,alternate_runtime)
- Read upRead up
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 evaluate_node
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def evaluate_node(node)
case node
when TemplateNode
node.items.map { |n| evaluate_node(n) }.join('')
when BlockExpressionNode
Method evaluate_block
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def evaluate_block(node,block_context=@context)
call = node.method.first
content_runtime = create_child_runtime(node.contents)
alternate_runtime = create_child_runtime(node.alternate) if node.respond_to? :alternate
block_runtime = BlockRuntime.new(block_context,content_runtime,alternate_runtime)
Method escape
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def escape(output)
if output.respond_to?(:html_safe) && output.html_safe?
# If the string is already marked as html_safe then don't
# escape it any further.
output
- Read upRead up
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 evaluate_call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_call(call, context=self.context, &block)
context = Helpers.decorate_with(context,@helpers,@locals) unless context.is_a? Helpers::Decorator
case call
when ParentCallNode
depth = call.depth
- Read upRead up
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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(ast, context=nil, locals={}, helpers=[],parent=nil)
Method evaluate_partial
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_partial(node)
_context = context
_context = evaluate_argument(node.context) if node.context
if defined?(::Rails)
context.send(:render, :partial => node.name, :object => _context)
- Read upRead up
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"