orange-cloudfoundry/cf-ops-automation

View on GitHub

Showing 41 of 962 total issues

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

  def load_deployment_config_files(deployment_name, deployers_config, enable_deployment_path)
    enable_deployment_file = File.join(enable_deployment_path, ENABLE_DEPLOYMENT_FILENAME)

    if File.exist?(enable_deployment_file)
      deployers_config.load_configs
Severity: Minor
Found in lib/root_deployment.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 clone_git_repository has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def clone_git_repository(boshrelease_name, git_url, base_git_clones_path, logs_path)
    git_clone_path = File.join(base_git_clones_path, boshrelease_name)
    error_message = ""
    status = nil
    cmd_line = "git clone \"#{git_url}\" \"#{git_clone_path}\""
Severity: Minor
Found in concourse/tasks/repackage_boshreleases/repackage_releases.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 validate_dir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_dir
    error_message = ''
    error_message << "\nPipelines directory does not exist: #{@pipelines_base_dir}" unless File.exist?(@pipelines_base_dir)
    error_message << "\nConfig directory does not exist: #{@config_dir}" unless File.exist?(@config_dir)
    error_message << "\nOutput directory does not exist: #{@output_dir}" unless File.exist?(@output_dir)

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_cf_app_details has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def load_cf_app_details(cf_app_name, cf_app_details, file, dir, cf_apps)
Severity: Minor
Found in lib/cf_apps.rb - About 35 mins to fix

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

  def processes_pipeline_definitions(deployment_details)
    deployment_details['pipelines'].each do |pipeline_name, pipeline_details|
      next unless pipeline_details
      unless pipeline_details_config_file?(pipeline_details)
        logger.debug "Generating default value for key config_file in #{pipeline_name}"
Severity: Minor
Found in lib/ci_deployment.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 insert_iaas_specific_into_init_pipeline_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def insert_iaas_specific_into_init_pipeline_config(ci_deployment_overview_files)
  migrated_counter = 0
  ci_deployment_overview_files&.each do |ci_deployment_filename|
    ci_deployment = YAML.load_file(ci_deployment_filename)
    unless ci_deployment
Severity: Minor
Found in upgrade/v3.1.0/01-upgrade-config.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 processes_ci_deployment_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def processes_ci_deployment_data(root_deployment_name, root_deployment_details, dir_basename)
    raise 'missing keys: expecting keys target and pipelines' unless root_deployment_details

    raise "Invalid deployment: expected <#{dir_basename}> - Found <#{root_deployment_name}>" if root_deployment_name != dir_basename

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

def insert_new_pipeline_configuration(ci_deployment_overview_files)
  migrated_counter = 0
  ci_deployment_overview_files&.each do |ci_deployment_filename|
    ci_deployment = YAML.load_file(ci_deployment_filename)
    unless ci_deployment
Severity: Minor
Found in upgrade/v3.2.0/01-upgrade-config.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 insert_iaas_specific_into_init_pipeline_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def insert_iaas_specific_into_init_pipeline_config(ci_deployment_overview_files)
  migrated_counter = 0
  ci_deployment_overview_files&.each do |ci_deployment_filename|
    ci_deployment = YAML.load_file(ci_deployment_filename)
    unless ci_deployment
Severity: Minor
Found in upgrade/v3.0.0/01-upgrade-config.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 process_releases_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process_releases_versions(resolved_manifest, versions)
    resolved_manifest['releases']&.each do |release|
      name, version = extract_release_manifest_info(release)
      lock_version, release_versions_details = extract_expected_info(name, versions)
      puts "WARNING: inconsistent versions detected. Release: #{name} - Manifest version: #{version} - COA expected version: #{lock_version}. Using COA version." if version != 'latest' && lock_version && version != lock_version
Severity: Minor
Found in concourse/tasks/resolve_manifest_versions/resolve_manifest_versions.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_boshrelease_namespaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_boshrelease_namespaces(repackaged_releases_path, successfully_processed)
    File.open(File.join(repackaged_releases_path, 'boshreleases-namespaces.csv'), 'a') do |file|
      successfully_processed.each do |name|
        version = @repackaged_errors&.dig(name, 'version')
        release_details = @repackaged_errors&.dig(name, 'repository')

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_warnings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_warnings
    warnings << "### WARNING ### no deployment detected. Please check\n template_dir: #{options.paas_templates_path}\n secrets_dir: #{options.secrets_path}" if ctxt.multi_root_dependencies&.empty?
    warnings << '### WARNING ### no ci deployment detected. Please check a valid ci-deployment-overview.yml exists' if ctxt.root_deployments.map { |name| ctxt.multi_root_ci_deployments&.empty? || ctxt.multi_root_ci_deployments[name]&.empty? }
                                                                                                                           .inject { |memo, element| memo && element }
    warnings << '### WARNING ### no cf app deployment detected. Please check a valid enable-cf-app.yml exists' if ctxt.multi_root_cf_apps&.empty?
Severity: Minor
Found in lib/shared_pipeline_generator.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 set_pipeline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def set_pipeline(target_name:, fly_bin: 'fly', team_name: 'main', name:, config:, load: [], options: [])
  if OPTIONS.key?(:match) && !name.include?(OPTIONS[:match])
    puts "Skipping pipeline loading, '--match' #{OPTIONS[:match]} exclude pipeline #{name}"
    return
  end
Severity: Minor
Found in scripts/concourse-shared-pipelines-update.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 remove_stemcell_key_from_deployment_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def remove_stemcell_key_from_deployment_dependencies(deployment_dependencies_files)
  migrated_counter = 0
  deployment_dependencies_files&.each do |deployment_dependencies_filename|
    deployment_dependencies = YAML.load_file(deployment_dependencies_filename)
    unless deployment_dependencies
Severity: Minor
Found in upgrade/v2.0.0/01-upgrade-paas-template.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 filter_releases has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_releases
    active_releases = @list_releases_command_holder.execute
    puts "Filtering releases"
    boshreleases_git_urls = @root_deployment.releases_git_urls
    boshreleases_git_urls.delete_if do |name, _url|
Severity: Minor
Found in concourse/tasks/repackage_boshreleases/repackage_releases.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 prepare_environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def prepare_environment(prereqs)
        logger.log_and_puts :debug, 'Preparing BOSH environment'
        upload_stemcell(prereqs.stemcell)              unless prereqs.inactive_step?("upload_stemcell")
        update_cloud_config(prereqs.cloud_config)      unless prereqs.inactive_step?("update_cloud_config")
        deploy_git_server(prereqs.git_server_manifest) unless prereqs.inactive_step?("deploy_git_server")
Severity: Minor
Found in lib/coa/env_bootstrapper/bosh.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
    public_config = private_config = nil
    public_config = YAML.load_file(@public_yaml, aliases: true) if File.exist?(@public_yaml)
    private_config = YAML.load_file(@private_yaml, aliases: true) if File.exist?(@private_yaml)
    @loaded_config = @loaded_config.deep_merge(public_config) unless public_config.nil?
Severity: Minor
Found in lib/config.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 set_pipeline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def set_pipeline(target_name:, fly_bin: 'fly', team_name: 'main', name:, config:, load: [], options: [])
  if OPTIONS.key?(:match) && !name.include?(OPTIONS[:match])
    puts "Skipping pipeline loading, '--match' #{OPTIONS[:match]} exclude pipeline #{name}"
    return
  end
Severity: Minor
Found in scripts/concourse-manual-pipelines-update.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 cleanup_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def cleanup_hash(an_hashmap)
  an_hashmap.each do |secret_key, value|
    # puts "Processing hash[#{secret_key}] = #{value}"
    # puts "  #{value} is a #{value.class}"
    # hash[secret_key]=value.class.to_s if value.is_a?(String) || value.is_a?(Numeric)
Severity: Minor
Found in scripts/anonymize_secrets.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 team has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.team(overview, root_deployment, pipeline_name)
    ci_root_deployment = overview[root_deployment]
    ci_pipelines = ci_root_deployment['pipelines'] unless ci_root_deployment.nil?
    ci_pipeline_found = ci_pipelines[pipeline_name] unless ci_pipelines.nil?
    ci_pipeline_found['team'] unless ci_pipeline_found.nil?
Severity: Minor
Found in lib/ci_deployment.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