tumugi/tumugi

View on GitHub

Showing 16 of 16 total issues

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

  class Task
    include Tumugi::Mixin::Parameterizable
    include Tumugi::Mixin::Listable
    include Tumugi::Mixin::TaskHelper
    include Tumugi::Mixin::HumanReadable
Severity: Minor
Found in lib/tumugi/task.rb - About 4 hrs to fix

    Class TaskDefinition has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class TaskDefinition
        include Tumugi::Mixin::Listable
        include Tumugi::Mixin::TaskHelper
    
        def self.define(id, opts={}, &block)
    Severity: Minor
    Found in lib/tumugi/task_definition.rb - About 2 hrs to fix

      Method dequeue_task has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def dequeue_task
              loop do
                task = @mutex.synchronize {
                  logger.trace { "task_queue_dump: #{@queue.map(&:id)}" } unless @queue.empty?
                  @queue.shift
      Severity: Minor
      Found in lib/tumugi/executor/local_executor.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 execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def execute(dag, options={})
              out = options[:out]
              if out
                ext = File.extname(options[:out])
                format = ext[1..-1] if ext.start_with?('.')
      Severity: Minor
      Found in lib/tumugi/command/show.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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def execute
              pool = Concurrent::ThreadPoolExecutor.new(
                min_threads: @worker_num,
                max_threads: @worker_num
              )
      Severity: Minor
      Found in lib/tumugi/executor/local_executor.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 section has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def section(name, &block)
            if block_given?
              raise Tumugi::ConfigError.new('You cannot change section') if frozen?
              @section_procs[name] ||= block
              return nil
      Severity: Minor
      Found in lib/tumugi/config.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 execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def execute
              pool = Concurrent::ThreadPoolExecutor.new(
                min_threads: @worker_num,
                max_threads: @worker_num
              )
      Severity: Minor
      Found in lib/tumugi/executor/local_executor.rb - About 1 hr to fix

        Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def execute(dag, options={})
                out = options[:out]
                if out
                  ext = File.extname(options[:out])
                  format = ext[1..-1] if ext.start_with?('.')
        Severity: Minor
        Found in lib/tumugi/command/show.rb - About 1 hr to fix

          Method mkdir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def mkdir(path, parents: true, raise_if_exist: false)
                  if File.exist?(path)
                    if raise_if_exist
                      raise FileAlreadyExistError.new("Path #{path} is already exist")
                    elsif !directory?(path)
          Severity: Minor
          Found in lib/tumugi/plugin/local_file_system.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 trigger! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def trigger!(event)
                @lock.synchronize do
                  now = Time.now
                  @_elapsed_times[tries] ||= { start: now }
          
          
          Severity: Minor
          Found in lib/tumugi/task.rb - About 1 hr to fix

            Method show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def show(dag)
                  headings = ['Task', 'Requires', 'Parameters', 'State', 'Elapsed']
                  Terminal::Table.new title: "Workflow Result", headings: headings do |t|
                    dag.tsort.map.with_index do |task, index|
                      proxy = task.class.merged_parameter_proxy
            Severity: Minor
            Found in lib/tumugi/dag_result_reporter.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 search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def search(type)
                  path = "#{@search_prefix}#{type}"
            
                  # prefer LOAD_PATH than gems
                  [@paths, $LOAD_PATH].each do |paths|
            Severity: Minor
            Found in lib/tumugi/registry.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 define_requires_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def define_requires_method(task_class)
                  td = self
                  task_class.class_eval do
                    define_method(:requires) do
                      reqs = td.required_tasks
            Severity: Minor
            Found in lib/tumugi/task_definition.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 setup_logger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def setup_logger(command, options)
                  log_format = (options[:log_format] || :text).to_sym
                  if command == :run && !options[:out].nil?
                    logger.init(output: options[:out], format: log_format)
                  else
            Severity: Minor
            Found in lib/tumugi/workflow.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 json_formatter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def json_formatter
                  Proc.new { |level, datetime, program_name, msg|
                    hash = { time: datetime, level: level, message: msg }
                    hash[:program_name] = program_name unless program_name.nil?
                    hash[:workflow] = workflow_id unless workflow_id.nil?
            Severity: Minor
            Found in lib/tumugi/logger/logger.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 load_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def load_config(options)
                  config_file = options[:config]
            
                  if config_file && !File.exist?(config_file)
                    raise Tumugi::TumugiError, "Config file '#{config_file}' does not exist"
            Severity: Minor
            Found in lib/tumugi/workflow.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

            Severity
            Category
            Status
            Source
            Language