Showing 122 of 128 total issues
Avoid deeply nested control flow statements. Open
v = ":".intern if v == :''
Method token_from_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def token_from_string(string)
check_encoding(string)
if Enclitics.include?(string.downcase)
Treat::Entities::Enclitic.new(string)
- 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 = false if v == 'false'
Avoid deeply nested control flow statements. Open
v = v.to_s if v.is_a?(DateTime)
Avoid deeply nested control flow statements. Open
v = true if v == 'true'
Avoid deeply nested control flow statements. Open
v = "*#{v.id}" if v.is_a?(Treat::Entities::Entity)
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_f if v =~ /^[0-9\.]*$/
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)
Avoid deeply nested control flow statements. Open
label = label[0..-4] unless label[-2] == '{'
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 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"
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 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 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 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 register
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def register(entity)
unless @registry
@count, @registry = 0,
{id: {}, value: {}, position:{}, type: {}}
end
- 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 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"