bumbleworks/bumbleworks

View on GitHub

Showing 23 of 23 total issues

Class Finder has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Finder
      class WorkitemQuery < Proc; end
      class TaskQuery < Proc; end

      WhereKeyToMethodMap = {
Severity: Minor
Found in lib/bumbleworks/task/finder.rb - About 4 hrs to fix

    Class Info has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Info < Ruote::Worker::Info
        attr_reader :worker
        extend Forwardable
        extend Enumerable
    
    
    Severity: Minor
    Found in lib/bumbleworks/worker/info.rb - About 4 hrs to fix

      Class Task has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Task
          include WorkitemEntityStorage
          include Support::WrapperComparison
      
          class AlreadyClaimed < StandardError; end
      Severity: Minor
      Found in lib/bumbleworks/task.rb - About 4 hrs to fix

        Class Process has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Process
            class EntityConflict < StandardError; end
        
            include WorkitemEntityStorage
            include Support::WrapperComparison
        Severity: Minor
        Found in lib/bumbleworks/process.rb - About 3 hrs to fix

          Method add_orderer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_orderer(fields, field_type = 'fields')
                  @orderers << Proc.new { |wi_x, wi_y|
                    relevant_direction, result = :asc, 0
                    fields.each do |field, direction|
                      sets = [wi_x['fields'], wi_y['fields']]
          Severity: Minor
          Found in lib/bumbleworks/task/finder.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

          Class Configuration has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Configuration
              attr_reader :storage_adapters
          
              class << self
                def define_setting(name)
          Severity: Minor
          Found in lib/bumbleworks/configuration.rb - About 2 hrs to fix

            Method create_all_from_directory! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def create_all_from_directory!(directory, opts = {})
                    added_names = []
                    definition_files = Bumbleworks::Support.all_files(directory)
                    if definition_files.values.uniq.count != definition_files.count
                      raise DuplicatesInDirectory, "Definitions directory contains duplicate filenames"
            Severity: Minor
            Found in lib/bumbleworks/process_definition.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 cancel_all_processes! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def cancel_all_processes!(options = {})
                    unless options[:method] == :kill
                      options[:method] = :cancel
                    end
            
            
            Severity: Minor
            Found in lib/bumbleworks/ruote.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 save has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def save
                  doc = Bumbleworks::Worker.info_document
            
                  worker_info_hash = doc['workers'][@worker.id] || {}
            
            
            Severity: Minor
            Found in lib/bumbleworks/worker/info.rb - About 1 hr to fix

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

                    def cancel_process!(wfid, options = {})
                      unless options[:method] == :kill
                        options[:method] = :cancel
                      end
              
              
              Severity: Minor
              Found in lib/bumbleworks/ruote.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 save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save
                    doc = Bumbleworks::Worker.info_document
              
                    worker_info_hash = doc['workers'][@worker.id] || {}
              
              
              Severity: Minor
              Found in lib/bumbleworks/worker/info.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 build! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build!
                    initialize_tree_from_definition! unless @tree
                    if @name = name_from_tree
                      @forced_name ||= name
                      raise InvalidTree, "Name does not match name in definition" if @forced_name != @name
              Severity: Minor
              Found in lib/bumbleworks/tree_builder.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 where has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def where(filters, group_type = nil)
                      group_type = :all unless group_type == :any
                      if group_type != @join
                        finder = self.class.new(@task_class)
                        finder.send(:"where_#{group_type}")
              Severity: Minor
              Found in lib/bumbleworks/task/finder.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 validate! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate!
                    errors = []
                    errors << "Name must be specified" unless @name
                    errors << "Definition or tree must be specified" unless @definition || @tree
                    begin
              Severity: Minor
              Found in lib/bumbleworks/process_definition.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

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

                  def constantize(name)
                    name_parts = name.split('::')
                    name_parts.shift if name_parts.first.empty?
                    constant = Object
              
              
              Severity: Minor
              Found in lib/bumbleworks/support.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 look_up_configured_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def look_up_configured_path(path_type, options = {})
                    return @cached_paths[path_type] if @cached_paths.has_key?(path_type)
                    if user_defined_path = user_configured_path(path_type)
                      if path_resolves?(user_defined_path, :file => options[:file])
                        return user_defined_path
              Severity: Minor
              Found in lib/bumbleworks/configuration.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 find_by_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def find_by_id(sid)
                      workitem = storage_participant[sid] if sid
                      raise MissingWorkitem unless workitem
                      new(workitem)
                    rescue ArgumentError => e
              Severity: Minor
              Found in lib/bumbleworks/task.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 filtered_task_from_raw_workitem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def filtered_task_from_raw_workitem(workitem, only_workitem_queries = false)
                      if only_workitem_queries
                        if check_queries(workitem, nil)
                          task = from_workitem(::Ruote::Workitem.new(workitem))
                        end
              Severity: Minor
              Found in lib/bumbleworks/task/finder.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 call_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def call_method(method_name, options = {})
                    result = if options[:args]
                      options[:args] = [options[:args]] if options[:args].is_a?(Hash)
                      entity.send(method_name, *options[:args])
                    else
              Severity: Minor
              Found in lib/bumbleworks/participants/entity_interactor.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    def autoload_all(options = {})
                      if directory = options[:directory] || Bumbleworks.tasks_directory
                        Bumbleworks::Support.all_files(directory, :camelize => true).each do |path, name|
                          Object.autoload name.to_sym, path
              Severity: Minor
              Found in lib/bumbleworks/task.rb and 1 other location - About 20 mins to fix
              lib/bumbleworks/participant_registration.rb on lines 11..14

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 27.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language