File optimism.rb
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "optimism/util"
require "optimism/parser"
require "optimism/semantics"
require "optimism/require"
Class Optimism
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Optimism
autoload :VERSION, "optimism/version"
Error = Class.new Exception
EMissingFile = Class.new Error
Method method_missing
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(name, *args, &blk)
return super if UNDEF_METHODS.include?(name)
# relative path: __
if 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 _fetch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _fetch(*args)
if args.length == 1 then
path_s = args[0]
raise_error = true
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 method_missing
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(name, *args, &blk)
return super if UNDEF_METHODS.include?(name)
# relative path: __
if name =~ /^__+$/
Method _fetch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _fetch(*args)
if args.length == 1 then
path_s = args[0]
raise_error = true
else
Method _convert_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _convert_hash(hash, opts={})
o = Optimism.new(nil, opts)
hash.each { |k, v|
v = _convert_hash(v, opts.merge(name: k.to_s, parent: o)) if Hash === v
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(content=nil, options={}, &blk)
@options = {symbolize_key: true}.merge(options)
@_parser = case (p=options[:parser])
when Symbol
- 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
Avoid too many return
statements within this method. Open
return !! _data[$1.to_sym]
Avoid too many return
statements within this method. Open
return _create_child_node(name, args[0], &blk)
Avoid too many return
statements within this method. Open
return _data.__send__(name, *args, &blk)
Method _walk_up
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _walk_up(path, opts={})
node = self
nodes = path.split(".")
nodes.reverse! if opts[:reverse]
- 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 _walk_down
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _walk_down(path, opts={})
node = self
nodes = path.split(".")
nodes.reverse! if opts[:reverse]
- 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 _symbolize_keys!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _symbolize_keys!(hash)
hash.keys.each do |key, value|
value = hash.delete(key)
_symbolize_keys!(value) if Hash === value
- 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"