ripta/drydock

View on GitHub

Showing 30 of 240 total issues

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

    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

    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

    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

    Method run has 57 lines of code (exceeds 25 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: Major
    Found in lib/drydock/phase_chain.rb - About 2 hrs to fix

      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

      Method create_container has 50 lines of code (exceeds 25 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 2 hrs to fix

        Method add has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def add(severity, message = nil, progname = nil, &block)
              annotation = nil
              indent     = 0
        
              if message.nil?
        Severity: Minor
        Found in lib/drydock/logger.rb - About 1 hr 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 parse! has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        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 - About 1 hr to fix

          Method find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.find(path, ignorefile, prepend_path: false, recursive: true)
                path = path.sub(%r{/$}, '')
          
                [].tap do |results|
                  ::Find.find(path) do |subpath|
          Severity: Minor
          Found in lib/drydock/file_manager.rb - About 1 hr 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 add has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def add(severity, message = nil, progname = nil, &block)
                annotation = nil
                indent     = 0
          
                if message.nil?
          Severity: Minor
          Found in lib/drydock/logger.rb - About 1 hr to fix

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

                def to_h
                  {}.tap do |commit|
                    if opts.key?(:command)
                      commit['run'] ||= {}
                      commit['run'][:Cmd] = opts[:command]
            Severity: Minor
            Found in lib/drydock/commit_options.rb - About 1 hr 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 archive_head has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def archive_head(path = '/', &blk)
                  query = { 'path' => path }
                  response = connection.raw_request(:head, path_for(:archive), query, response_block: blk)
            
                  return if response.nil?
            Severity: Minor
            Found in lib/drydock/docker_api_patch.rb - About 45 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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(file_or_filename, dotfiles: false)
                  @dotfiles = dotfiles
            
                  if file_or_filename.respond_to?(:readlines)
                    patterns = Array(file_or_filename.readlines)
            Severity: Minor
            Found in lib/drydock/ignorefile_definition.rb - About 45 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 write_to_container has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def write_to_container(buffer, digest)
                    label = "# COPY #{recursive ? 'dir' : 'file'}:md5:#{digest} TO #{target_path}"
            
                    chain.run(label, no_cache: no_cache) do |container|
                      target_stat = container.archive_head(target_path)
            Severity: Minor
            Found in lib/drydock/instructions/copy.rb - About 45 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 propagate_config! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            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 - About 45 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

            Avoid too many return statements within this method.
            Open

                  return false if self['Entrypoint'] != other['Entrypoint']
            Severity: Major
            Found in lib/drydock/container_config.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return false unless other_ports.key?(my_port)
              Severity: Major
              Found in lib/drydock/container_config.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return false if Array(self['Env']).sort != Array(other['Env']).sort
                Severity: Major
                Found in lib/drydock/container_config.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return false if self['Tty'] != other['Tty']
                  Severity: Major
                  Found in lib/drydock/container_config.rb - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language