Class VariableScope
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class VariableScope
# To handle Module#private, protected
attr_accessor :method_visibility
attr_reader :parent
Method local_variables
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def local_variables
locals = []
scope = self
# Ascend up through all applicable blocks to get all vars.
- 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 set_eval_local
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_eval_local(name, val)
scope = @parent
while scope
if scope.dynamic_locals.key? name
scope.dynamic_locals[name] = val
- 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 eval_local_defined?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def eval_local_defined?(name, search=true)
if search
scope = self
while scope
return true if scope.dynamic_locals.key? name
- 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 synthesize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.synthesize(method, module_, parent, self_, block, locals)
Avoid too many return
statements within this method. Open
return nil