orange-cloudfoundry/cf-ops-automation

View on GitHub

Showing 41 of 956 total issues

File shared_pipeline_generator.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'optparse'

require_relative './config'
require_relative './extended_config'
require_relative './bosh_certificates'
Severity: Minor
Found in lib/shared_pipeline_generator.rb - About 2 hrs to fix

Method migrate_to_root_deployment_yml has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def migrate_to_root_deployment_yml(paas_template_root)
  root_deployment_migrated = 0
  incomplete_releases = {}
  root_deployments_path = Dir["#{paas_template_root}/*-depls"]
  puts root_deployments_path
Severity: Minor
Found in upgrade/v5.0.0/01-upgrade-paas-template.rb - About 2 hrs 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_pipeline_config has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def insert_pipeline_config(ci_deployment_overview)
  migrated = false
  ci_deployment_overview['ci-deployment']&.each do |_, details|
    additional_pipelines = {}
    details['pipelines']&.select { |name, _| name.end_with?('-init-generated') }
Severity: Minor
Found in upgrade/v3.2.0/01-upgrade-config.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 migrate_to_root_deployment_yml has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def migrate_to_root_deployment_yml(paas_template_root)
  root_deployment_migrated = 0
  incomplete_releases = {}
  root_deployments_path = Dir["#{paas_template_root}/*-depls"]
  puts root_deployments_path
Severity: Minor
Found in upgrade/v5.0.0/01-upgrade-paas-template.rb - About 1 hr to fix

Method option_parser has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def option_parser(options)
        OptionParser.new do |opts|
          opts.banner = "Incomplete/wrong parameter(s): #{opts.default_argv}.\n Usage: ./#{opts.program_name} <options>"

          opts.on('-d', '--depls ROOT_DEPLOYMENT', 'Specify a root deployment name to generate template for. MANDATORY') do |deployment_string|
Severity: Minor
Found in lib/pipeline_generator.rb - About 1 hr to fix

Method option_parser has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def option_parser(options)
        OptionParser.new do |opts|
          opts.banner = "Incomplete/wrong parameter(s): #{opts.default_argv}.\n Usage: ./#{opts.program_name} <options>"

          opts.on('-d', '--depls ROOT_DEPLOYMENT', 'Specify a root deployment name to generate template for') do |deployment_string|
Severity: Minor
Found in lib/shared_pipeline_generator.rb - About 1 hr to fix

Method set_context has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_context
    shared_config  = File.join(options.paas_templates_path, 'shared-config.yml')
    private_config = File.join(options.secrets_path, 'private-config.yml')
    profiles = if options.profiles_auto_sort
                 options.profiles.sort
Severity: Minor
Found in lib/shared_pipeline_generator.rb - About 1 hr to fix

Method insert_pipeline_config has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def insert_pipeline_config(ci_deployment_overview)
  migrated = false
  ci_deployment_overview['ci-deployment']&.each do |_, details|
    additional_pipelines = {}
    details['pipelines']&.select { |name, _| name.end_with?('-init-generated') }
Severity: Minor
Found in upgrade/v3.2.0/01-upgrade-config.rb - About 1 hr to fix

Method process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process(repackaged_releases_path, base_git_clones_path, logs_path)
    errors = {}
    successfully_processed = []
    begin
      releases_not_uploaded_to_director = filter_releases
Severity: Minor
Found in concourse/tasks/repackage_boshreleases/repackage_releases.rb - About 1 hr to fix

Method validate_dir has a Cognitive Complexity of 10 (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 << "\nTemplates directory does not exist: #{@templates_dir}" unless File.exist?(@templates_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 insert_iaas_specific_pipeline has a Cognitive Complexity of 9 (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?('-init-generated') || name == 'bootstrap-all-init-pipelines'
Severity: Minor
Found in upgrade/v3.0.0/01-upgrade-config.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 select_submodules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def select_submodules(clean_paths)
    git_submodules = {}
    clean_paths.each do |path|
      parsed_path = path.split('/')
      next if parsed_path.length < 2
Severity: Minor
Found in lib/git_modules.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 process_upgrade_files has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def process_upgrade_files(config_dir, templates_dir, upgrade_scripts)
  config_dir_as_param = File.absolute_path(config_dir)
  templates_dir_as_param = File.absolute_path(templates_dir)
  overall_status_success = true
  error_message = 'Failed to execute: \n'
Severity: Minor
Found in upgrade/run_upgrade.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 download_boshrelease has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def download_boshrelease(url, boshrelease_filename, download_path, max_retry = 3)
    retries ||= 0
    puts "Start downloading #{boshrelease_filename} from #{url}"
    begin
      download(url, download_path)

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

  def run
    concourse_url = @config[:concourse_url]
    concourse_password = @config[:concourse_password]
    concourse_username = @config[:concourse_username]
    @fly_main.login(url = concourse_url, password = concourse_password)
Severity: Minor
Found in upgrade/coa_version_update.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 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

Severity
Category
Status
Source
Language