orange-cloudfoundry/cf-ops-automation

View on GitHub

Showing 41 of 963 total issues

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

      def push_cf_ops_automation
        logger.log_and_puts :debug, "Setup cf_ops_automation push at <#{PROJECT_ROOT_DIR}>"
        Dir.chdir PROJECT_ROOT_DIR do
          remote_name = "remote-" + SecureRandom.hex
          branch_name = "br-" + SecureRandom.hex
Severity: Minor
Found in lib/coa/env_bootstrapper/git.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 insert_iaas_specific_pipeline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def insert_iaas_specific_pipeline(ci_deployment_overview)
  migrated = false
  ci_deployment_overview['ci-deployment']&.each do |_, details|
    details['pipelines']&.each do |name, pipeline_config|
      if name.end_with?('-s3-br-ulpload-generated')
Severity: Minor
Found in upgrade/v3.1.0/01-upgrade-config.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 configure_logging has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def configure_logging(options)
  secrets_path = options[:secrets_path]
  private_config_file = File.join(secrets_path, 'private-config.yml')
  private_config = {}
  YAML.load_file(private_config_file) || {} if File.exist? private_config_file
Severity: Minor
Found in scripts/generate-depls.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_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_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_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 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 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 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 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 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 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 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate
        generated_pipeline_list.each do |pipeline_filename|
          puts "validating #{pipeline_filename}"
          command = "fly validate-pipeline -c #{pipeline_filename} --var=stemcell-main-name=my-stemcell-name"
          stdout_str, stderr_str, = Open3.capture3(command)
Severity: Minor
Found in lib/coa/reference_dataset_documentation/pipelines.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 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 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

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 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

Severity
Category
Status
Source
Language