mattbrictson/tomo

View on GitHub

Showing 12 of 16 total issues

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

      def to_s # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
        desc = []
        threads = [applicable_hosts.length, concurrency].min
        desc << "CONCURRENTLY (#{threads} THREADS):" if threads > 1
        applicable_hosts.each do |host|
Severity: Minor
Found in lib/tomo/runtime/explanation.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 git_origin_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def git_origin_url
        return unless File.file?(".git/config")
        return unless `git remote -v`.match?(/^origin/)

        url = `git remote get-url origin`.chomp
Severity: Minor
Found in lib/tomo/commands/init.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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def execute(thread_pool:, remotes:)
        return if applicable_tasks.empty?

        thread_pool.post do
          applicable_tasks.each do |task|
Severity: Minor
Found in lib/tomo/runtime/host_execution_step.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update
      return if settings[:env_vars].empty?

      modify_env_file do |env|
        settings[:env_vars].each do |name, value|
Severity: Minor
Found in lib/tomo/plugin/env/tasks.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 handle_error has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_error(error, command_name)
      return if Completions.active?
      raise error unless error.respond_to?(:to_console)

      error.command_name = command_name if error.respond_to?(:command_name=)
Severity: Minor
Found in lib/tomo/cli.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 check_required_rules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_required_rules(state)
        (rules.to_a - state.processed_rules).each do |rule|
          next unless rule.required?

          type = rule.is_a?(Rules::Argument) ? "" : " option"
Severity: Minor
Found in lib/tomo/cli/parser.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 register_plugins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def register_plugins
      plugins_registry = PluginsRegistry.new

      (["core"] + plugins.uniq).each do |plug|
        if plug.start_with?(".", "/")
Severity: Minor
Found in lib/tomo/configuration.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 lookup_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def lookup_command(argv)
      command_name = argv.first unless Completions.active? && argv.length == 1
      command_name = Abbrev.abbrev(COMMANDS.keys)[command_name]
      argv.shift if command_name

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

    def prompt_for(name, message: nil)
      synchronize do
        @answers ||= {}
        next @answers[name] if @answers.key?(name)

Severity: Minor
Found in lib/tomo/plugin/env/tasks.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 script_end has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def script_end(script, result)
      return unless result.failure?
      return unless script.silent?
      return unless script.raise_on_error?

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

      def build_args(host, script, control_path, verbose) # rubocop:disable Metrics/AbcSize
        args = [verbose ? "-v" : ["-o", "LogLevel=ERROR"]]
        args << "-A" if forward_agent
        args << connect_timeout_option
        args << strict_host_key_checking_option
Severity: Minor
Found in lib/tomo/ssh/options.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 validate_environment! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_environment!(name)
      if name.nil?
        raise_no_environment_specified unless environments.empty?
      else
        raise_unknown_environment(name) unless environments.key?(name)
Severity: Minor
Found in lib/tomo/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

Severity
Category
Status
Source
Language