cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub

Showing 1,157 of 1,705 total issues

Method add_agent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_agent(deployment_name, vm_data)
      unless vm_data.kind_of?(Hash)
        @logger.error("Invalid format for VM data: expected Hash, got #{vm_data.class}: #{vm_data}")
        return false
      end
Severity: Minor
Found in bosh-monitor/lib/bosh/monitor/agent_manager.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 run_prepare_script has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.run_prepare_script(script_path)
      unless File.exists?(script_path)
        raise InvalidJob, "Prepare script at `#{script_path}' doesn't exist"
      end

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

      def self.process(args = nil)
        disk_info = []
        settings = Bosh::Agent::Config.settings

        if settings["disks"].kind_of?(Hash) && settings["disks"]["persistent"].kind_of?(Hash)
Severity: Minor
Found in bosh_agent/lib/bosh_agent/message/list_disk.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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def process(alert)
        deployment = alert.attributes['deployment']
        job = alert.attributes['job']
        index = alert.attributes['index']

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

    def keep_new_file
      copy_to_file = @diff_works ? @deployment_file : @deployment_file + ".new"
      agree_text = @diff_works ?
          KEEP_NEW_VERSION_TEXT : (DIFF_FAILED_KEEP_NEW_TEXT % copy_to_file)
      if non_interactive? or agree(agree_text)
Severity: Minor
Found in bosh_cli/lib/cli/commands/biff.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 release_version_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def release_version_details(releases)
      currently_deployed = false
      uncommitted_changes = false
      releases.each do |release|
        release['release_versions'].each do |version|
Severity: Minor
Found in bosh_cli/lib/cli/commands/release.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 migrate_legacy_configs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def migrate_legacy_configs
      # We're using blobstore_options as old config marker.
      # Unfortunately old CLI won't tell you to upgrade because it checks
      # for valid blobstore options first, so instead of removing
      # blobstore_options we mark it as deprecated, so new CLI proceeds
Severity: Minor
Found in bosh_cli/lib/cli/release.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 search_parse_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def search_parse_tree(node)
      return nil if node.nil?
      arg = @args.shift

      longer_command = search_parse_tree(node[arg])
Severity: Minor
Found in bosh_cli/lib/cli/runner.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 generate_tarball has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_tarball
      version = fingerprint
      tmp_file = Tempfile.new(name)

      say('Generating...')
Severity: Minor
Found in bosh_cli/lib/cli/packaging_helper.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 print_string_diff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def print_string_diff(str1, str2)
      File.open(@temp_file_path_1, "w") { |f| f.write(str1) }
      File.open(@temp_file_path_2, "w") { |f| f.write(str2) }

      @diff_works = true
Severity: Minor
Found in bosh_cli/lib/cli/commands/biff.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 step has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def step(name, error_message, kind = :non_fatal, &block)
      say("%-60s " % [name], "")

      passed = yield

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

    def output
      body, new_offset = @director.get_task_output(@task_id, @offset, @log_type)

      @buf << body if body

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

    def list(job = nil, index = nil)
      auth_required

      deployment_name = prepare_deployment_manifest['name']
      say("Deployment `#{deployment_name.make_green}'")
Severity: Minor
Found in bosh_cli/lib/cli/commands/snapshot.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 make_fingerprint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def make_fingerprint
      versioning_scheme = 2
      contents = "v#{versioning_scheme}"

      signatures = glob_matches.map do |match|
Severity: Minor
Found in bosh_cli/lib/cli/package_builder.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 merge_private_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_private_data(provider, options)
      bs = @private_config["blobstore"]
      return options unless bs

      if bs[provider].nil? && has_blobstore_secret?
Severity: Minor
Found in bosh_cli/lib/cli/release.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 add_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_version(fingerprint, item, tmp_file_path = nil)
      version = item["version"]

      if version.blank?
        raise InvalidIndex,
Severity: Minor
Found in bosh_cli/lib/cli/versions_index.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_releases_table_for_old_director has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def build_releases_table_for_old_director(releases)
      table do |t|
        t.headings = 'Name', 'Versions'
        releases.each do |release|
          versions = release['versions'].sort { |v1, v2|
Severity: Minor
Found in bosh_cli/lib/cli/commands/release.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 deployment_changed? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def deployment_changed?(current_manifest, manifest, show = true)
      diff = Bosh::Cli::HashChangeset.new
      diff.add_hash(normalize_deployment_manifest(manifest), :new)
      diff.add_hash(normalize_deployment_manifest(current_manifest), :old)
      changed = diff.changed?
Severity: Minor
Found in bosh_cli/lib/cli/deployment_helper.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 try_alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def try_alias
      # Tries to find best match among aliases (possibly multiple words),
      # then unwinds it onto the remaining args and searches parse tree again.
      # Not the most effective algorithm but does the job.
      config = Bosh::Cli::Config.new(@options[:config])
Severity: Minor
Found in bosh_cli/lib/cli/runner.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 print_feature_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def print_feature_list(features)
      if features.respond_to?(:each)
        features.each do |feature, info|
          # Old director only returns status as a Boolean
          if info.kind_of?(Hash)
Severity: Minor
Found in bosh_cli/lib/cli/commands/misc.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