File fast.rb
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require 'astrolabe/builder'
require_relative 'fast/rewriter'
# suppress output to avoid parser gem warnings'
Method search
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def search(pattern, node, *args)
if (match = match?(pattern, node, *args))
yield node, match if block_given?
match != true ? [node, match] : [node]
else
- 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 parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse
case (token = next_token)
when '(' then parse_until_peek(')')
when '{' then Any.new(parse_until_peek('}'))
when '[' then All.new(parse_until_peek(']'))
- 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 capture
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def capture(pattern, node)
if (match = match?(pattern, node))
match == true ? node : match
else
node.each_child_node
- 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 match_recursive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def match_recursive(expression, node)
case expression
when Proc then expression.call(node)
when Find then expression.match?(node)
when Symbol then compare_symbol_or_head(expression, node)
- 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"