louismullie/treat

View on GitHub

Showing 128 of 128 total issues

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?
Severity: Minor
Found in lib/treat/workers/processors/parsers/enju.rb - About 1 hr 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 anything_from_string has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def anything_from_string(string)
    case self.mn.downcase.intern
    when :document
      folder = Treat.paths.files
      if folder[-1] == '/'
Severity: Minor
Found in lib/treat/entities/entity/buildable.rb - About 1 hr to fix

    Method search has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.search(collection, options = {})
        
        options = DefaultOptions.merge(options)
        
        unless collection.has?(:index)
    Severity: Minor
    Found in lib/treat/workers/retrievers/searchers/ferret.rb - About 1 hr to fix

      Method download_stanford has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.download_stanford(package = :minimal)
      
          f = StanfordPackages[package]
          url = "http://#{Server}/treat/#{f}"
          loc = Schiphol.download(url,
      Severity: Minor
      Found in lib/treat/core/installer.rb - About 1 hr to fix

        Method time has 37 lines of code (exceeds 25 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 1 hr to fix

          Method from_folder has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def from_folder(folder)
          
              return if Reserved.include?(folder)
          
              unless FileTest.directory?(folder)
          Severity: Minor
          Found in lib/treat/entities/entity/buildable.rb - About 1 hr to fix

            Method tag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.tag(entity, options = {})
            
                # Handle tags for sentences and phrases.
                if entity.is_a?(Treat::Entities::Group) &&
                  !entity.parent_sentence
            Severity: Minor
            Found in lib/treat/workers/lexicalizers/taggers/stanford.rb - About 1 hr 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 read has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.read(document, options = {})
            
                raise 'Not implemented.'
            
                options = DefaultOptions.merge(options)
            Severity: Minor
            Found in lib/treat/workers/formatters/readers/xml.rb - About 1 hr 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 implode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def implode(value = "")
                
                return @value.dup if !has_children?
                
                each do |child|
            Severity: Minor
            Found in lib/treat/entities/entity/stringable.rb - About 1 hr 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 category has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.category(entity, options = {})
            
                tag = entity.check_has(:tag)
                
                return 'unknown' if tag.nil? || tag == ''
            Severity: Minor
            Found in lib/treat/workers/lexicalizers/categorizers/from_tag.rb - About 1 hr to fix

              Method read has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.read(document, options = {})
              
                  raise 'Not implemented.'
              
                  options = DefaultOptions.merge(options)
              Severity: Minor
              Found in lib/treat/workers/formatters/readers/xml.rb - About 1 hr to fix

                Method load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.load(klass, name, language = nil)
                    
                    return if @@loaded[klass]
                    
                    language ||= Treat.core.language.default
                Severity: Minor
                Found in lib/treat/loaders/bind_it.rb - About 1 hr to fix

                  Method download_stanford has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.download_stanford(package = :minimal)
                  
                      f = StanfordPackages[package]
                      url = "http://#{Server}/treat/#{f}"
                      loc = Schiphol.download(url,
                  Severity: Minor
                  Found in lib/treat/core/installer.rb - About 1 hr 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 compare_with has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def compare_with(klass)
                      i = 0; rank_a = nil; rank_b = nil
                      Treat.core.entities.order.each do |type|
                        klass2 = Treat::Entities.const_get(type.cc)
                        rank_a = i if self <= klass2
                  Severity: Minor
                  Found in lib/treat/entities/entity/comparable.rb - About 1 hr 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 search has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.search(collection, options = {})
                      
                      options = DefaultOptions.merge(options)
                      
                      unless collection.has?(:index)
                  Severity: Minor
                  Found in lib/treat/workers/retrievers/searchers/ferret.rb - About 1 hr 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 do_task has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def do_task(task, worker, options, group = nil)
                      group ||= get_group(task)
                      entity_types = group.targets
                      f = nil
                      entity_types.each do |t|
                  Severity: Minor
                  Found in lib/treat/entities/entity/applicable.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.unserialize(entity, options={})
                      
                      db = options.delete(:db)
                      selector = options
                      
                  Severity: Minor
                  Found in lib/treat/workers/formatters/unserializers/mongo.rb - About 1 hr 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 31 lines of code (exceeds 25 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 1 hr to fix

                    Method install has 31 lines of code (exceeds 25 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 1 hr to fix

                      Method keywords has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.keywords(entity, options = {})
                          
                          options = DefaultOptions.merge(options)
                          tf_idfs = {}
                          
                      Severity: Minor
                      Found in lib/treat/workers/extractors/keywords/tf_idf.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language