Showing 128 of 128 total issues
Method similarity
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.similarity(entity, options={})
raise 'Not currently implemented.'
unless options[:to] &&
Method detect_format
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.detect_format(filename, default_to = nil)
default_to ||= DefaultOptions[:default_to]
ext = filename.scan(ExtensionRegexp)
ext = (ext.is_a?(Array) && ext[0] && ext[0][0]) ? ext[0][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 load
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.load(klass, name, language = nil)
return if @@loaded[klass]
language ||= Treat.core.language.default
- 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_presets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_presets(group)
opt = group.preset_option
return unless opt
- 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 initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(question, *exports)
unless question.is_a?(Treat::Learning::Question)
raise Treat::Exception,
"The first argument to initialize " +
"should be an instance of " +
Method tag
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.tag(entity, options = {})
options = DefaultOptions.merge(options)
@@tagger ||= ::EngTagger.new(options)
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.index(collection, options = {})
unless collection.get(:folder)
raise Treat::Exception,
"Only collections stored on disk " +
Method initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name, default = nil, proc_string = nil)
unless name.is_a?(Symbol)
raise Treat::Exception,
"The first argument to initialize should "+
"be a symbol representing the name of the export."
Method recurse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.recurse(java_node, ruby_node, tag_set)
java_node.children.each do |java_child|
label = java_child.label
- 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 chunk
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.chunk(entity, options = {})
entity.check_hasnt_children
zones = entity.to_s.split("\n")
current = 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 do_serialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.do_serialize(entity, options)
children = []
if options[:recursive] && entity.has_children?
- 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 initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, default = nil, proc_string = nil)
unless name.is_a?(Symbol)
raise Treat::Exception,
"The first argument to initialize should "+
"be a symbol representing the name of the export."
- 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 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 = true if v == 'true'
Method declense
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.declense(entity, options = {})
cat = entity.get(:category)
return if cat && !POS.include?(cat)
- 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 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 = v ? v.inspect : ' -- '
Method from_marshal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.from_marshal(options)
file = options[:file]
data = Marshal.load(File.binread(file))
problem, items = *data
problem.features.each do |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
Avoid deeply nested control flow statements. Open
v = ":".intern if v == :''