swipely/docker-api

View on GitHub
lib/docker/image.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Image has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

class Docker::Image
  include Docker::Base

  # Given a command and optional list of streams to attach to, run a command on
  # an Image. This will not modify the Image, but rather create a new Container
Severity: Minor
Found in lib/docker/image.rb - About 3 hrs to fix

    File image.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Docker::Image
      include Docker::Base
    
      # Given a command and optional list of streams to attach to, run a command on
      # an Image. This will not modify the Image, but rather create a new Container
    Severity: Minor
    Found in lib/docker/image.rb - About 2 hrs to fix

      Method build_from_tar has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def build_from_tar(tar, opts = {}, connection = Docker.connection,
                             creds = nil, &block)
      Severity: Minor
      Found in lib/docker/image.rb - About 35 mins to fix

        Method build_from_dir has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def build_from_dir(dir, opts = {}, connection = Docker.connection,
                               creds = nil, &block)
        Severity: Minor
        Found in lib/docker/image.rb - About 35 mins to fix

          Method load has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def load(tar, opts = {}, conn = Docker.connection, creds = nil, &block)
          Severity: Minor
          Found in lib/docker/image.rb - About 35 mins to fix

            Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def create(opts = {}, creds = nil, conn = Docker.connection, &block)
                  credentials = creds.nil? ? Docker.creds : MultiJson.dump(creds)
                  headers = credentials && Docker::Util.build_auth_header(credentials) || {}
                  body = ''
                  conn.post(
            Severity: Minor
            Found in lib/docker/image.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def run(cmd = nil, options = {})
                opts = {'Image' => self.id}.merge(options)
                opts["Cmd"] = cmd.is_a?(String) ? cmd.split(/\s+/) : cmd
                begin
                  Docker::Container.create(opts, connection)
            Severity: Minor
            Found in lib/docker/image.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

            There are no issues that match your filters.

            Category
            Status