Showing 128 of 128 total issues
Method to_dot
has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring. Open
def self.to_dot(entity, options)
# Filter out specified types.
match_types = lambda do |t1, t2s|
f = false
t2s.each { |t2| f = true if Treat::Entities.match_types[t1][t2] }
- 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 86 (exceeds 5 allowed). Consider refactoring. Open
def self.unserialize(document, options = {})
# Read in the XML file.
xml = File.read(document.file)
xml.gsub!('<treat>', '')
xml.gsub!('</treat>', '')
- 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 a Cognitive Complexity of 36 (exceeds 5 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
- 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 a Cognitive Complexity of 34 (exceeds 5 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('|')})"
- 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 recurse
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def self.recurse(node, html_node, level = 1)
html_node.children.each do |child|
next if child.name == 'text'
- 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 to_dot
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_dot(entity, options)
# Filter out specified types.
match_types = lambda do |t1, t2s|
f = false
t2s.each { |t2| f = true if Treat::Entities.match_types[t1][t2] }
Method tf_idf
has a Cognitive Complexity of 26 (exceeds 5 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)
- 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
File buildable.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Treat::Entities::Entity::Buildable
require 'schiphol'
require 'fileutils'
require 'uri'
Method method
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.method
return @method if @method
m = self.mn.ucc.dup
if m[-4..-1] == 'zers'
if type == :annotator
- 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 25 (exceeds 5 allowed). Consider refactoring. Open
def self.tag(entity, options = {})
options = DefaultOptions.merge(options)
@@tagger ||= ::EngTagger.new(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
File tags.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
{
aligned: {
tag_sets: [
:claws_c5, :brown, :penn,
:stutgart, :chinese, :paris7
Method unserialize
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.unserialize(document, options = {})
# Read in the XML file.
xml = File.read(document.file)
xml.gsub!('<treat>', '')
xml.gsub!('</treat>', '')
Method cleanup_attributes
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.cleanup_attributes(name, attributes)
new_attr = {}
edges = {}
pred = attributes.delete('pred')
- 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 a Cognitive Complexity of 23 (exceeds 5 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
- 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 time
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.time(entity, options = {})
s = entity.to_s
return if s =~ /^[0-9]+$/
- 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
File spanish.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
{
dependencies: [
'punkt-segmenter',
'tactful_tokenizer'
],
File swedish.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
{
dependencies: [
'punkt-segmenter',
'tactful_tokenizer'
],
Method build
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def build(*args)
# This probably needs some doc.
if args.size == 0
file_or_value = ''
- 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 apply
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def apply(*tasks)
tasks.each do |task|
if task.is_a?(Hash)
- 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 build
has a Cognitive Complexity of 20 (exceeds 5 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
- 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"