louismullie/treat

View on GitHub

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] }
Severity: Minor
Found in lib/treat/workers/formatters/visualizers/dot.rb - About 2 days 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 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>', '')
Severity: Minor
Found in lib/treat/workers/formatters/unserializers/xml.rb - About 1 day 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 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
Severity: Minor
Found in lib/treat/workers/inflectors/stemmers/porter.rb - About 5 hrs 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 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'
Severity: Minor
Found in lib/treat/workers/processors/chunkers/html.rb - About 5 hrs 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 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('|')})"
Severity: Minor
Found in lib/treat/entities/entity/magical.rb - About 5 hrs 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 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] }
Severity: Major
Found in lib/treat/workers/formatters/visualizers/dot.rb - About 3 hrs to fix

    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)
    Severity: Minor
    Found in lib/treat/workers/extractors/tf_idf/native.rb - About 3 hrs 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

    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'
    Severity: Minor
    Found in lib/treat/entities/entity/buildable.rb - About 3 hrs to fix

      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)
      Severity: Minor
      Found in lib/treat/workers/lexicalizers/taggers/lingua.rb - About 3 hrs 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 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
      Severity: Minor
      Found in lib/treat/workers/groupable.rb - About 3 hrs 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

      File tags.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      {
        aligned: {
          tag_sets: [
            :claws_c5, :brown, :penn,
            :stutgart, :chinese, :paris7
      Severity: Minor
      Found in lib/treat/config/data/tags.rb - About 3 hrs to fix

        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>', '')
        Severity: Major
        Found in lib/treat/workers/formatters/unserializers/xml.rb - About 3 hrs to fix

          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
          Severity: Minor
          Found in lib/treat/entities/entity/debuggable.rb - About 3 hrs 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 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')
          Severity: Minor
          Found in lib/treat/workers/processors/parsers/enju.rb - About 3 hrs 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 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]+$/
              
          Severity: Minor
          Found in lib/treat/workers/extractors/time/nickel.rb - About 3 hrs 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

          File spanish.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          {
            dependencies: [
              'punkt-segmenter', 
              'tactful_tokenizer'
            ],
          Severity: Minor
          Found in lib/treat/config/data/languages/spanish.rb - About 3 hrs to fix

            File swedish.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            {
              dependencies: [
                'punkt-segmenter', 
                'tactful_tokenizer'
              ],
            Severity: Minor
            Found in lib/treat/config/data/languages/swedish.rb - About 2 hrs to fix

              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 = ''
              Severity: Minor
              Found in lib/treat/entities/entity/buildable.rb - About 2 hrs 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 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)
              
              
              Severity: Minor
              Found in lib/treat/entities/entity/applicable.rb - About 2 hrs 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 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
              Severity: Minor
              Found in lib/treat/workers/processors/parsers/enju.rb - About 2 hrs 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