louismullie/treat

View on GitHub

Showing 128 of 128 total issues

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
Severity: Minor
Found in lib/treat/workers/formatters/readers/abw.rb - About 35 mins to fix

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] && 
Severity: Minor
Found in lib/treat/workers/extractors/similarity/tf_idf.rb - About 35 mins to fix

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
Severity: Minor
Found in lib/treat/workers/formatters/visualizers/standoff.rb - About 35 mins to fix

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 too many return statements within this method.
Open

    return :unknown if cat == nil
Severity: Major
Found in lib/treat/workers/lexicalizers/categorizers/from_tag.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return 'G' if entity.is_a?(Treat::Entities::Group)
    Severity: Major
    Found in lib/treat/workers/lexicalizers/taggers/lingua.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return cat[ts]
      Severity: Major
      Found in lib/treat/workers/lexicalizers/categorizers/from_tag.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return Ptc[entity.to_s] if entity.type == :punctuation
        Severity: Major
        Found in lib/treat/workers/lexicalizers/categorizers/from_tag.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return tok.tag if isolated_token
          Severity: Major
          Found in lib/treat/workers/lexicalizers/taggers/stanford.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return 'G' if entity.is_a?(Treat::Entities::Group)
            Severity: Major
            Found in lib/treat/workers/lexicalizers/taggers/brill.rb - About 30 mins to fix

              Method export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def export(entity, exports)
                  unless @question.target == entity.type
                    targ, type = @question.target, entity.type
                    raise Treat::Exception, 
                    "This classification problem targets " +
              Severity: Minor
              Found in lib/treat/learning/problem.rb - About 25 mins to fix

              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 serialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.serialize(entity, options = {})
              
                  options = DefaultOptions.merge(options)
                  options[:stop_at] = options[:stop_at] ?
                  Treat::Entities.const_get(
              Severity: Minor
              Found in lib/treat/workers/formatters/serializers/mongo.rb - About 25 mins to fix

              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 from_serialized_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def from_serialized_file(file)
              
                  unless File.readable?(file)
                    raise Treat::Exception,
                    "Path '#{file}' does not "+
              Severity: Minor
              Found in lib/treat/entities/entity/buildable.rb - About 25 mins to fix

              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 remove_time_from_ancestors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.remove_time_from_ancestors(entity, time)
                  
                  entity.ancestors_with_type(:phrase).each do |a|
                    
                    next if !a.has?(:time)
              Severity: Minor
              Found in lib/treat/workers/extractors/time/ruby.rb - About 25 mins to fix

              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 align_tags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

               def self.align_tags(tags, tag_sets)
                 wttc = {}
                 tags.each_slice(2) do |desc, tags|
                   category = desc.gsub(',', ' ,').
                   split(' ')[0].downcase
              Severity: Minor
              Found in lib/treat/config/tags.rb - About 25 mins to fix

              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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.parse(entity, options = {})
              
                  val, lang = entity.to_s, entity.language.intern
              
                  Treat::Loaders::Stanford.load(lang)
              Severity: Minor
              Found in lib/treat/workers/processors/parsers/stanford.rb - About 25 mins to fix

              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_tokens has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.add_tokens(entity, tokens, options)
                  tokens.each do |token|
                    val = token.value
                     unless options[:escape_characters]
                       Treat.tags.ptb.escape_characters.
              Severity: Minor
              Found in lib/treat/workers/processors/tokenizers/stanford.rb - About 25 mins to fix

              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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.sense(word, options = nil)
              
                  category = word.check_has(:category)
              
                  if !options[:nym]
              Severity: Minor
              Found in lib/treat/workers/lexicalizers/sensers/wordnet.rb - About 25 mins to fix

              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 remove_time_from_ancestors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.remove_time_from_ancestors(entity, time)
                  
                  entity.ancestors_with_type(:phrase).each do |a|
                    
                    next if !a.has?(:time)
              Severity: Minor
              Found in lib/treat/workers/extractors/time/chronic.rb - About 25 mins to fix

              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 install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.install(language = 'english')
              
                  # Require the Rubygem dependency installer.
                  silence_warnings do
                    require 'rubygems/dependency_installer'
              Severity: Minor
              Found in lib/treat/core/installer.rb - About 25 mins to fix

              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 << has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def <<(entities, clear_parent = true)
                    entities = (entities.is_a?(::String) ||
                    entities.is_a?(::Numeric)) ? 
                    entities.to_entity : entities
                    entities = entities.is_a?(::Array) ?
              Severity: Minor
              Found in lib/treat/entities/entity.rb - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language