File dslkit.rb
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'thread'
require 'sync'
require 'tins/thread_local'
Method dsl_accessor
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def dsl_accessor(name, *default, &block)
variable = "@#{name}"
define_method(name) do |*args|
if args.empty?
result =
- 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 dsl_reader
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def dsl_reader(name, *default, &block)
variable = "@#{name}"
define_method(name) do |*args|
if args.empty?
result =
- 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 with
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.with(*ids)
opts = Hash === ids.last ? ids.pop : {}
ids = ids.map { |id| Regexp === id ? id : id.to_s }
klass = opts[:superclass] ? Class.new(opts[:superclass]) : Class.new
klass.instance_eval do
- 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 delegate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delegate(method_name, opts = {})
to = opts[:to] || UNSET
as = opts[:as] || method_name
raise ArgumentError, "to argument wasn't defined" if to == UNSET
to = to.to_s
Method delegate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delegate(method_name, opts = {})
to = opts[:to] || UNSET
as = opts[:as] || method_name
raise ArgumentError, "to argument wasn't defined" if to == UNSET
to = to.to_s
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(id, *args)
self.dynamic_scope_name ||= :variables
if args.empty? and scope_reverse(dynamic_scope_name) { |c| c.key?(id) and return c[id] }
super
elsif args.size == 1 and id.to_s =~ /(.*?)=\Z/
- 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 deflect_start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def deflect_start(from, id, deflector)
@@sync.synchronize do
Deflect.deflecting ||= DeflectorCollection.new
Deflect.deflecting.member?(from, id) and
raise DeflectError, "#{from}##{id} is already deflected"
- 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 thread_global
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def thread_global(name, default_value = nil, &default)
is_a?(Module) or raise TypeError, "receiver has to be a Module"
default_value && default and raise ArgumentError,
"require either default_falue or default block"
- 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"