louismullie/treat

View on GitHub

Showing 122 of 128 total issues

Avoid deeply nested control flow statements.
Open

                v = "*#{v.id}" if v.is_a?(Treat::Entities::Entity)
Severity: Major
Found in lib/treat/workers/formatters/visualizers/dot.rb - About 45 mins to fix

    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 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 = ":".intern if v == :''
      Severity: Major
      Found in lib/treat/workers/formatters/unserializers/xml.rb - About 45 mins to fix

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

            def self.conjugate(entity, options = {})
              
              options = DefaultOptions.merge(options)
              cat = entity.check_has(:category)
              return if cat != 'verb' && options[:strict]
          Severity: Minor
          Found in lib/treat/workers/inflectors/conjugators/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 set_group_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_group_options(group, conf)
                group.module_eval do
                  extend Treat::Workers::Groupable
                  self.type = conf.type
                  self.targets = conf.targets
            Severity: Minor
            Found in lib/treat/workers/categorizable.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

                          label = label[0..-4] unless label[-2] == '{'
            Severity: Major
            Found in lib/treat/workers/formatters/visualizers/dot.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          elsif value.is_a?(Hash)
                            label << "\\n#{feature}: \\n\{ "
                            value.each do |k,v|
                              v = v ? v.inspect : ' -- '
                              v = escape(v)
              Severity: Major
              Found in lib/treat/workers/formatters/visualizers/dot.rb - About 45 mins to fix

                Method call_worker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def call_worker(entity, task, worker, group, options)
                Severity: Minor
                Found in lib/treat/entities/entity/delegatable.rb - About 35 mins to fix

                  Method print_debug has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def print_debug(entity, task, worker, group, options)
                  Severity: Minor
                  Found in lib/treat/entities/entity/debuggable.rb - About 35 mins to fix

                    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

                    Method ancestor_with_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def ancestor_with_type(type)
                        return unless has_parent?
                        ancestor = @parent
                        type_klass = Treat::Entities.const_get(type.cc)
                        while not ancestor.is_a?(type_klass)
                    Severity: Minor
                    Found in lib/treat/entities/entity/iterable.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 method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def method_missing(sym, *args, &block)
                          if [:do, :apply].include?(sym) || 
                            Treat::Workers.lookup(sym)
                            map do |el|
                              if el.is_a?(Treat::Entities::Entity)
                    Severity: Minor
                    Found in lib/treat/proxies/array.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 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 set_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.set_options(lang, options)
                        
                        return @@segmenters[lang] if @@segmenters[lang]
                        
                        if options[:model]
                    Severity: Minor
                    Found in lib/treat/workers/processors/segmenters/punkt.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 add_workers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def add_workers(group)
                        self.class_eval do
                          task = group.method
                          add_presets(group)
                          define_method(task) do |worker=nil, options={}|
                    Severity: Minor
                    Found in lib/treat/entities/entity/delegatable.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 each_entity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def each_entity(*types)
                        types = [:entity] if types.size == 0
                        f = false
                        types.each do |t2|
                          if is_a?(Treat::Entities.const_get(t2.cc))
                    Severity: Minor
                    Found in lib/treat/entities/entity/iterable.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

                    Severity
                    Category
                    Status
                    Source
                    Language