nicholasjackson/minke

View on GitHub
lib/minke/docker/docker_runner.rb

Summary

Maintainability
C
7 hrs
Test Coverage

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

There are no issues that match your filters.

Category
Status