ripta/drydock

View on GitHub

Showing 240 of 240 total issues

Class has too many lines. [243/100]
Open

  class Project

    DEFAULT_OPTIONS = {
      auto_remove: true,
      author: nil,
Severity: Minor
Found in lib/drydock/project.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [191/100]
Open

  class PhaseChain
    extend Forwardable
    include Enumerable

    attr_reader :children, :ephemeral_containers
Severity: Minor
Found in lib/drydock/phase_chain.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for run is too high. [58.06/15]
Open

    def run(cmd, opts = {})
      src_image = last ? last.result_image : @from
      no_commit = opts.fetch(:no_commit, false)

      no_cache = opts.fetch(:no_cache, false)
Severity: Minor
Found in lib/drydock/phase_chain.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

Assignment Branch Condition size for == is too high. [55.3/15]
Open

    def ==(other)
      return false if other.nil?

      return false if self['OpenStdin'] || other['OpenStdin']
      return false if self['AttachStdout'] != other['AttachStdout']
Severity: Minor
Found in lib/drydock/container_config.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 has too many lines. [57/20]
Open

    def run(cmd, opts = {})
      src_image = last ? last.result_image : @from
      no_commit = opts.fetch(:no_commit, false)

      no_cache = opts.fetch(:no_cache, false)
Severity: Minor
Found in lib/drydock/phase_chain.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [50/20]
Open

    def self.create_container(cfg, &blk)
      meta_options = cfg[:MetaOptions] || {}
      timeout = meta_options.fetch(:read_timeout, Excon.defaults[:read_timeout]) || 60

      Drydock.logger.debug(message: "Create container configuration: #{cfg.inspect}")
Severity: Minor
Found in lib/drydock/phase_chain.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class Project has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Project

    DEFAULT_OPTIONS = {
      auto_remove: true,
      author: nil,
Severity: Minor
Found in lib/drydock/project.rb - About 4 hrs to fix

    Assignment Branch Condition size for create_container is too high. [36.62/15]
    Open

        def self.create_container(cfg, &blk)
          meta_options = cfg[:MetaOptions] || {}
          timeout = meta_options.fetch(:read_timeout, Excon.defaults[:read_timeout]) || 60
    
          Drydock.logger.debug(message: "Create container configuration: #{cfg.inspect}")
    Severity: Minor
    Found in lib/drydock/phase_chain.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 has too many lines. [41/20]
    Open

        def self.parse!(args)
          opts = new
    
          parser = OptionParser.new do |cfg|
            cfg.banner = "Usage: #{$PROGRAM_NAME} [options...] [drydock-filename]"
    Severity: Minor
    Found in lib/drydock/runtime_options.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    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 run has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(cmd, opts = {})
          src_image = last ? last.result_image : @from
          no_commit = opts.fetch(:no_commit, false)
    
          no_cache = opts.fetch(:no_cache, false)
    Severity: Minor
    Found in lib/drydock/phase_chain.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

    Assignment Branch Condition size for parse! is too high. [32.33/15]
    Open

        def self.parse!(args)
          opts = new
    
          parser = OptionParser.new do |cfg|
            cfg.banner = "Usage: #{$PROGRAM_NAME} [options...] [drydock-filename]"
    Severity: Minor
    Found in lib/drydock/runtime_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

    Cyclomatic complexity for == is too high. [22/6]
    Open

        def ==(other)
          return false if other.nil?
    
          return false if self['OpenStdin'] || other['OpenStdin']
          return false if self['AttachStdout'] != other['AttachStdout']
    Severity: Minor
    Found in lib/drydock/container_config.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for == is too high. [22/7]
    Open

        def ==(other)
          return false if other.nil?
    
          return false if self['OpenStdin'] || other['OpenStdin']
          return false if self['AttachStdout'] != other['AttachStdout']
    Severity: Minor
    Found in lib/drydock/container_config.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

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

        def self.create_container(cfg, &blk)
          meta_options = cfg[:MetaOptions] || {}
          timeout = meta_options.fetch(:read_timeout, Excon.defaults[:read_timeout]) || 60
    
          Drydock.logger.debug(message: "Create container configuration: #{cfg.inspect}")
    Severity: Minor
    Found in lib/drydock/phase_chain.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

    Perceived complexity for run is too high. [20/7]
    Open

        def run(cmd, opts = {})
          src_image = last ? last.result_image : @from
          no_commit = opts.fetch(:no_commit, false)
    
          no_cache = opts.fetch(:no_cache, false)
    Severity: Minor
    Found in lib/drydock/phase_chain.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Assignment Branch Condition size for propagate_config! is too high. [28.35/15]
    Open

        def self.propagate_config!(src_image, config_name, opts, opt_key)
          if opts.key?(opt_key)
            Drydock.logger.info("Command override: #{opts[opt_key].inspect}")
          else
            src_image.refresh!
    Severity: Minor
    Found in lib/drydock/phase_chain.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 has too many lines. [32/20]
    Open

        def add(severity, message = nil, progname = nil, &block)
          annotation = nil
          indent     = 0
    
          if message.nil?
    Severity: Minor
    Found in lib/drydock/logger.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for run is too high. [16/6]
    Open

        def run(cmd, opts = {})
          src_image = last ? last.result_image : @from
          no_commit = opts.fetch(:no_commit, false)
    
          no_cache = opts.fetch(:no_cache, false)
    Severity: Minor
    Found in lib/drydock/phase_chain.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Method == has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def ==(other)
          return false if other.nil?
    
          return false if self['OpenStdin'] || other['OpenStdin']
          return false if self['AttachStdout'] != other['AttachStdout']
    Severity: Minor
    Found in lib/drydock/container_config.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

    Severity
    Category
    Status
    Source
    Language