Showing 122 of 128 total issues
Method recurse
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.recurse(entity, options)
spaces, string = '', ''
options[:indent].times { spaces << ' ' }
attributes = " id='#{entity.id}'"
if !entity.features.nil? && entity.features.size != 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 category
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.category(entity, options = {})
tag = entity.check_has(:tag)
return 'unknown' if tag.nil? || tag == ''
- 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 stem
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.stem(word, options = {})
# Copy the word and convert it to a string.
w = word.to_s
return w if w.length < 3
# Map initial y to Y so that the patterns
Method tf_idf
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.tf_idf(entity, options={})
l = Treat.languages[entity.language]
if l.respond_to?(:stop_words)
@@cw[entity.language] = l.stop_words
return 0 if @@cw[entity.language].include?(entity.value)
Method from_folder
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def from_folder(folder)
return if Reserved.include?(folder)
unless FileTest.directory?(folder)
- 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 magic
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def magic(sym, *args)
# Cache this for performance.
@@entities_regexp ||= "(#{Treat.core.entities.list.join('|')})"
@@cats_regexp ||= "(#{Treat.linguistics.categories.join('|')})"
Method build
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build(xml, remove_last = false)
# Read in the XML file.
reader = Nokogiri::XML::Reader.from_memory(xml)
entity = nil
pd = 0
Method split
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.split(string, options)
s = " " + string + " "
s.gsub!(/‘/,"'")
Method extended
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.extended(group)
group.module_eval do
class << self
Method cleanup_attributes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.cleanup_attributes(name, attributes)
new_attr = {}
edges = {}
pred = attributes.delete('pred')
Method keywords
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.keywords(entity, options = {})
options = DefaultOptions.merge(options)
tf_idfs = {}
- 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 language
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def language(extractor = nil, options = {})
return Treat.core.language.default if
!Treat.core.language.detect
- 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 print_debug
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_debug(entity, task, worker, group, options)
# Get a list of the worker's targets.
targets = group.targets.map(&:to_s)
# List the worker's targets as either
Method recurse
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.recurse(entity, options)
spaces, string = '', ''
options[:indent].times { spaces << ' ' }
attributes = " id='#{entity.id}'"
if !entity.features.nil? && entity.features.size != 0
Method build
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build(*args)
# This probably needs some doc.
if args.size == 0
file_or_value = ''
Method unserialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.unserialize(entity, options={})
db = options.delete(:db)
selector = options
Method recurse
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.recurse(node, html_node, level = 1)
html_node.children.each do |child|
next if child.name == 'text'
Method add_edges
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.add_edges(entity2)
entity2.each_entity(:word, :phrase) do |entity|
@@edges_table.each_pair do |id, edges|
next if edges.nil?
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def self.tag(entity, options = {})
# Create the tagger if necessary
@@tagger ||= ::Brill::Tagger.new(options[:lexicon],
options[:lexical_rules], options[:contextual_rules])
- 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 name_tag
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.name_tag(entity, options = {})
language = entity.language
Treat::Loaders::Stanford.load(language)
- 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"