swipely/docker-api

View on GitHub
lib/docker/container.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Class Container has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class Docker::Container
  include Docker::Base

  # Update the @info hash, which is the only mutable state in this object.
  #   e.g. if you would like a live status from the #info hash, call #refresh! first.
Severity: Minor
Found in lib/docker/container.rb - About 3 hrs to fix

    File container.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Docker::Container
      include Docker::Base
    
      # Update the @info hash, which is the only mutable state in this object.
      #   e.g. if you would like a live status from the #info hash, call #refresh! first.
    Severity: Minor
    Found in lib/docker/container.rb - About 2 hrs to fix

      Method exec has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def exec(command, options = {}, &block)
          # Establish values
          tty = options.delete(:tty) || false
          detach = options.delete(:detach) || false
          user = options.delete(:user)
      Severity: Minor
      Found in lib/docker/container.rb - About 1 hr to fix

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

          def stats(options = {})
            if block_given?
              options[:read_timeout] ||= 10
              options[:idempotent] ||= false
              parser = lambda do |chunk, remaining_bytes, total_bytes|
        Severity: Minor
        Found in lib/docker/container.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 top has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def top(opts = {})
            format = opts.delete(:format) { :array }
            resp = Docker::Util.parse_json(connection.get(path_for(:top), opts))
            if resp['Processes'].nil?
              format == :array ? [] : {}
        Severity: Minor
        Found in lib/docker/container.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