nicholasjackson/minke

View on GitHub

Showing 21 of 24 total issues

Method create_and_run_container has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def create_and_run_container args
          # update the timeout for the Excon Http Client
          # set the chunk size to enable streaming of log files
        ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}
        container = ::Docker::Container.create(
Severity: Minor
Found in lib/minke/docker/docker_runner.rb - About 3 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 create_logger has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create_logger(output, verbose = false)
      Logger.new(output).tap do |l|
        l.datetime_format = ''
        l.formatter = proc do |severity, datetime, progname, msg|
          if msg != nil
Severity: Minor
Found in lib/minke/logger.rb - About 3 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 read_task_section has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def read_task_section section, docker_config
        Task.new.tap do |t|
          t.consul_loader = read_consul_loader_section section['consul_loader']  unless section['consul_loader'] == nil
          t.health_check  = read_url section['health_check']                     unless section['health_check'] == nil
          t.docker        = read_docker_section section['docker']                unless section['docker'] == nil
Severity: Minor
Found in lib/minke/config/reader.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 process has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def process config
        replace_variables config.template_location

        replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil
        replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil
Severity: Minor
Found in lib/minke/generators/config_processor.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 run_with_block has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def run_with_block
        success = true

        begin
          @docker_network.create
Severity: Minor
Found in lib/minke/tasks/task.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 read has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def read config_file
        b = binding

        config = Config.new
        file   = ERB.new(File.read(config_file)).result b
Severity: Minor
Found in lib/minke/config/reader.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 read_docker_registry has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def read_docker_registry section
        DockerRegistrySettings.new.tap do |d|
          d.url       = section['url'].is_a?(Hash) ? read_secure(section['url']) : section['url']
          d.user      = section['user'].is_a?(Hash) ? read_secure(section['user']) : section['user']
          d.password  = section['password'].is_a?(Hash) ? read_secure(section['password']) : section['password']
Severity: Minor
Found in lib/minke/config/reader.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 read_docker_section has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def read_docker_section section
        DockerSettings.new.tap do |d|
          d.build_image              = section['build_image']              unless section['build_image'] == nil
          d.build_docker_file        = section['build_docker_file']        unless section['build_docker_file'] == nil
          d.application_docker_file  = section['application_docker_file']  unless section['application_docker_file'] == nil
Severity: Minor
Found in lib/minke/config/reader.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 create_dependencies has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def create_dependencies task
      project_name = "minke#{SecureRandom.urlsafe_base64(12)}".downcase.gsub(/[^0-9a-z ]/i, '')
      network_name = ENV['DOCKER_NETWORK'] ||= "#{project_name}_default"
      ENV['DOCKER_PROJECT'] = project_name
      ENV['DOCKER_NETWORK'] = network_name
Severity: Minor
Found in lib/minke/command.rb - About 1 hr to fix

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

      def run_command_in_container(command, blocking = false, links = nil, ports = nil)
        begin
          @logger.info "Running command: #{command}"
          settings          = @generator_config.build_settings.docker_settings
          volumes           = settings.binds.clone unless settings.binds == nil
Severity: Minor
Found in lib/minke/tasks/task.rb - About 1 hr to fix

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

      def create_and_run_blocking_container args
        host_config = get_port_bindings args
        host_config['NetworkMode'] = @network
        host_config['Binds'] = args[:volumes]

Severity: Minor
Found in lib/minke/docker/docker_runner.rb - About 1 hr to fix

Method run_command_in_container has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def run_command_in_container(command, blocking = false, links = nil, ports = nil)
        begin
          @logger.info "Running command: #{command}"
          settings          = @generator_config.build_settings.docker_settings
          volumes           = settings.binds.clone unless settings.binds == nil
Severity: Minor
Found in lib/minke/tasks/task.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def run args = nil
          @logger.info "## Running cucumber with tags #{args}"

        compose_file = @config.compose_file_for(@task_name)
        compose_file = File.expand_path(compose_file)
Severity: Minor
Found in lib/minke/tasks/cucumber.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def process generator_name, output_folder
        generator = get_generator generator_name

        # process the files
        @logger.info '# Modifiying templates'
Severity: Minor
Found in lib/minke/generators/processor.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 build_image has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def build_image dockerfile_dir, name
        ::Docker.options = {:read_timeout => 6200}
        begin
          ::Docker::Image.build_from_dir(dockerfile_dir, {:t => name}) do |v|
            data = /{"stream.*:"(.*)".*/.match(v)
Severity: Minor
Found in lib/minke/docker/docker_runner.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 create_and_run_container has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def create_and_run_container args
          # update the timeout for the Excon Http Client
          # set the chunk size to enable streaming of log files
        ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}
        container = ::Docker::Container.create(
Severity: Minor
Found in lib/minke/docker/docker_runner.rb - About 1 hr to fix

Method run_with_block has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def run_with_block
        success = true

        begin
          @docker_network.create
Severity: Minor
Found in lib/minke/tasks/task.rb - About 1 hr to fix

Method read_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def read_url section
        URL.new.tap do |url|
          url.address  = section['address']
          url.port     = section['port']     != nil ? section['port'].to_s : '80'
          url.path     = section['path']     != nil ? section['path'] : ''
Severity: Minor
Found in lib/minke/config/reader.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def execute command, ignore_error=false
        @logger.debug command
        
        Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
          while line = stdout_err.gets
Severity: Minor
Found in lib/minke/helpers/shell.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_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def process_file template_location, original, output_folder, service_name
        new_filename = create_new_filename template_location, original, output_folder, service_name

        dirname = File.dirname(new_filename)
        unless File.directory?(dirname)
Severity: Minor
Found in lib/minke/generators/processor.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