ripta/drydock

View on GitHub
lib/drydock/container_options.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for to_h is too high. [34.1/15]
Open

    def to_h
      to_container_config.tap do |cc|
        env = Array(opts[:env])
        cc[:Env].push(*env) unless env.empty?

Severity: Minor
Found in lib/drydock/container_options.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method to_h has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def to_h
      to_container_config.tap do |cc|
        env = Array(opts[:env])
        cc[:Env].push(*env) unless env.empty?

Severity: Minor
Found in lib/drydock/container_options.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

Empty line missing at class body end.
Open

  end
Severity: Minor
Found in lib/drydock/container_options.rb by rubocop

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Use %i or %I for an array of symbols.
Open

        [:connect_timeout, :read_timeout].each do |key|
Severity: Minor
Found in lib/drydock/container_options.rb by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Empty line missing at class body beginning.
Open

    attr_reader :image_id, :opts
Severity: Minor
Found in lib/drydock/container_options.rb by rubocop

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

There are no issues that match your filters.

Category
Status