Showing 122 of 128 total issues
Avoid deeply nested control flow statements. Open
v = "*#{v.id}" if v.is_a?(Treat::Entities::Entity)
Avoid deeply nested control flow statements. Open
v = v ? v.inspect : ' -- '
Method anything_from_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def anything_from_string(string)
case self.mn.downcase.intern
when :document
folder = Treat.paths.files
if folder[-1] == '/'
- 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 deeply nested control flow statements. Open
v = ":".intern if v == :''
Avoid deeply nested control flow statements. Open
v = true if v == 'true'
Method conjugate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.conjugate(entity, options = {})
options = DefaultOptions.merge(options)
cat = entity.check_has(:category)
return if cat != 'verb' && options[:strict]
- 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 deeply nested control flow statements. Open
v = v.to_s if v.is_a?(DateTime)
Method set_group_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_group_options(group, conf)
group.module_eval do
extend Treat::Workers::Groupable
self.type = conf.type
self.targets = conf.targets
- 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 deeply nested control flow statements. Open
label = label[0..-4] unless label[-2] == '{'
Avoid deeply nested control flow statements. Open
elsif value.is_a?(Hash)
label << "\\n#{feature}: \\n\{ "
value.each do |k,v|
v = v ? v.inspect : ' -- '
v = escape(v)
Method call_worker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call_worker(entity, task, worker, group, options)
Method print_debug
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def print_debug(entity, task, worker, group, options)
Method visualize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.visualize(entity, options = {})
options = DefaultOptions.merge(options)
value = ''; spaces = ''
options[:indent].times { spaces << ' '}
options[:indent] += 1
- 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 ancestor_with_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ancestor_with_type(type)
return unless has_parent?
ancestor = @parent
type_klass = Treat::Entities.const_get(type.cc)
while not ancestor.is_a?(type_klass)
- 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(sym, *args, &block)
if [:do, :apply].include?(sym) ||
Treat::Workers.lookup(sym)
map do |el|
if el.is_a?(Treat::Entities::Entity)
- 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 similarity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.similarity(entity, options={})
raise 'Not currently implemented.'
unless options[:to] &&
- 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 text
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def text(s)
if s != 'AbiWord' && s !=
'application/x-abiword'
s.strip!
if s.length > 0
- 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_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.set_options(lang, options)
return @@segmenters[lang] if @@segmenters[lang]
if options[:model]
- 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 add_workers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_workers(group)
self.class_eval do
task = group.method
add_presets(group)
define_method(task) do |worker=nil, options={}|
- 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 each_entity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each_entity(*types)
types = [:entity] if types.size == 0
f = false
types.each do |t2|
if is_a?(Treat::Entities.const_get(t2.cc))
- 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"