cloudfoundry/dea_ng

View on GitHub
lib/container/container.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

class Container
  class WardenError < StandardError
    attr_reader :result

    def initialize(message, response=nil)
Severity: Minor
Found in lib/container/container.rb - About 3 hrs to fix

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

      def run_script(name, script, privileged=false, discard_output=false, log_tag=nil)
    Severity: Minor
    Found in lib/container/container.rb - About 35 mins to fix

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

        def create_container(params)
          [:bind_mounts, :limit_cpu, :byte, :inode, :limit_memory, :setup_inbound_network, :rootfs].each do |param|
            raise ArgumentError, "expecting #{param.to_s} parameter to create container" if params[param].nil?
          end
      
      
      Severity: Minor
      Found in lib/container/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