Showing 122 of 128 total issues
Method num_children_with_feature
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def num_children_with_feature(feature, value = nil, recursive = true)
i = 0
m = method(recursive ? :each_entity : :each)
m.call do |c|
next unless c.has?(feature)
- 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 anything_from_string
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def anything_from_string(string)
case self.mn.downcase.intern
when :document
folder = Treat.paths.files
if folder[-1] == '/'
Method download_stanford
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.download_stanford(package = :minimal)
f = StanfordPackages[package]
url = "http://#{Server}/treat/#{f}"
loc = Schiphol.download(url,
Method search
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.search(collection, options = {})
options = DefaultOptions.merge(options)
unless collection.has?(:index)
Method time
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.time(entity, options = {})
s = entity.to_s
return if s =~ /^[0-9]+$/
Method from_folder
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_folder(folder)
return if Reserved.include?(folder)
unless FileTest.directory?(folder)
Method read
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.read(document, options = {})
raise 'Not implemented.'
options = DefaultOptions.merge(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 implode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def implode(value = "")
return @value.dup if !has_children?
each do |child|
- 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 tag
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.tag(entity, options = {})
# Handle tags for sentences and phrases.
if entity.is_a?(Treat::Entities::Group) &&
!entity.parent_sentence
- 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 category
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.category(entity, options = {})
tag = entity.check_has(:tag)
return 'unknown' if tag.nil? || tag == ''
Method read
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.read(document, options = {})
raise 'Not implemented.'
options = DefaultOptions.merge(options)
Method load
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.load(klass, name, language = nil)
return if @@loaded[klass]
language ||= Treat.core.language.default
Method compare_with
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def compare_with(klass)
i = 0; rank_a = nil; rank_b = nil
Treat.core.entities.order.each do |type|
klass2 = Treat::Entities.const_get(type.cc)
rank_a = i if self <= klass2
- 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 do_task
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def do_task(task, worker, options, group = nil)
group ||= get_group(task)
entity_types = group.targets
f = nil
entity_types.each do |t|
- 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 download_stanford
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.download_stanford(package = :minimal)
f = StanfordPackages[package]
url = "http://#{Server}/treat/#{f}"
loc = Schiphol.download(url,
- 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 unserialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.unserialize(entity, options={})
db = options.delete(:db)
selector = 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 search
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.search(collection, options = {})
options = DefaultOptions.merge(options)
unless collection.has?(:index)
- 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 sense
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.sense(word, options = nil)
category = word.check_has(:category)
if !options[:nym]
Method install
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.install(language = 'english')
# Require the Rubygem dependency installer.
silence_warnings do
require 'rubygems/dependency_installer'
Method keywords
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.keywords(entity, options = {})
options = DefaultOptions.merge(options)
tf_idfs = {}