louismullie/treat

View on GitHub

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

    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] : ''
    Severity: Minor
    Found in lib/treat/workers/formatters/readers/autoselect.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 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
    Severity: Minor
    Found in lib/treat/loaders/bind_it.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 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
    
    
    Severity: Minor
    Found in lib/treat/entities/entity/delegatable.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 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 " +
    Severity: Minor
    Found in lib/treat/learning/problem.rb - About 1 hr to fix

      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)
      Severity: Minor
      Found in lib/treat/workers/lexicalizers/taggers/lingua.rb - About 1 hr to fix

        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 " +
        Severity: Minor
        Found in lib/treat/workers/retrievers/indexers/ferret.rb - About 1 hr to fix

          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."
          Severity: Minor
          Found in lib/treat/learning/export.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/treat/workers/processors/parsers/stanford.rb - About 55 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 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
            Severity: Minor
            Found in lib/treat/workers/processors/chunkers/txt.rb - About 55 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 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?
            Severity: Minor
            Found in lib/treat/workers/formatters/serializers/mongo.rb - About 55 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 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."
            Severity: Minor
            Found in lib/treat/learning/export.rb - About 55 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 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)
            Severity: Minor
            Found in lib/treat/entities/entity/buildable.rb - About 45 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 deeply nested control flow statements.
            Open

                        v = true if v == 'true'
            Severity: Major
            Found in lib/treat/workers/formatters/unserializers/xml.rb - About 45 mins to fix

              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)
                  
              Severity: Minor
              Found in lib/treat/workers/inflectors/declensors/linguistics.rb - About 45 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 deeply nested control flow statements.
              Open

                              v = v.to_s if v.is_a?(DateTime)
              Severity: Major
              Found in lib/treat/workers/formatters/visualizers/dot.rb - About 45 mins to fix

                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] == '/'
                Severity: Minor
                Found in lib/treat/entities/entity/buildable.rb - About 45 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 deeply nested control flow statements.
                Open

                                v = v ? v.inspect : ' -- '
                Severity: Major
                Found in lib/treat/workers/formatters/visualizers/dot.rb - About 45 mins to fix

                  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|
                  Severity: Minor
                  Found in lib/treat/learning/data_set.rb - About 45 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 deeply nested control flow statements.
                  Open

                              v = ":".intern if v == :''
                  Severity: Major
                  Found in lib/treat/workers/formatters/unserializers/xml.rb - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language