factor-io/factor

View on GitHub

Showing 5 of 5 total issues

Method load_connector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def load_connector(options, address, parameters)
        service_name = address.split('::')[0]
        connector_settings = settings[service_name] || {}

        if options.connector
Severity: Minor
Found in lib/factor/commands/run_command.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 aggregate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.aggregate(method, *handlers, &block)
        block ||= lambda {|v| true}
        Future.new do
          handlers.each {|handler| handler.execute if handler.unscheduled?}
          completed = handlers.map do |handler|
Severity: Minor
Found in lib/factor/workflow/future.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 load_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def load_settings(options)
        settings_file = DEFAULT_SETTINGS_FILENAME
        settings = {}
        if options.settings
          info "Using '#{options.settings}' settings file" if options.verbose
Severity: Minor
Found in lib/factor/commands/base.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(promise=nil, &block)
        raise ArgumentError, "promise or block required" unless promise || block
        raise ArgumentError, "promise and block can't both be provided" if promise && block
        raise ArgumentError, "promise must be a Concurrent::Promise" if promise && !promise.is_a?(Concurrent::Promise)

Severity: Minor
Found in lib/factor/workflow/future.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def run(args, options)
        load_settings(options)

        workflow_filename = File.expand_path(args[0])
        info "Loading workflow from '#{workflow_filename}'" if options.verbose
Severity: Minor
Found in lib/factor/commands/workflow_command.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