moneybird/dockistrano

View on GitHub

Showing 9 of 15 total issues

Class Service has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Service

    attr_reader :dependencies, :config, :image_name, :registry,
      :tag, :test_command, :provides_env, :backing_service_env,
      :data_directories, :environment, :host, :additional_commands,
Severity: Minor
Found in lib/dockistrano/service.rb - About 5 hrs to fix

    File service.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'yaml'
    require 'net/http'
    
    module Dockistrano
    
    
    Severity: Minor
    Found in lib/dockistrano/service.rb - About 3 hrs to fix

      Class Docker has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Docker
      
          class EnvironmentVariableMissing < StandardError
          end
      
      
      Severity: Minor
      Found in lib/dockistrano/docker.rb - About 2 hrs to fix

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

            def self.execute(command, mode=:string_result)
              case mode
              when :string_result
                Dockistrano::CommandLine.command_with_result("#{docker_command} #{command.collect { |c| c.kind_of?(String) ? c : arguments(c) }.join(" ")}".strip)
              when :stream
        Severity: Minor
        Found in lib/dockistrano/docker.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 status has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def status
              say "DOCKISTRANO_ENVIRONMENT: #{options["environment"]}", :green
              say "DOCKER_HOST_IP: #{ENV['DOCKER_HOST_IP']}", :green
              say "DOCKER_BINARY: #{ENV['DOCKER_BINARY']}", :green
              say ""
        Severity: Minor
        Found in lib/dockistrano/cli.rb - About 1 hr to fix

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

              def config=(config)
                @config = config
                @dependencies = config["dependencies"] || {}
                @image_name ||= (config["image_name"] || Git.repository_name).gsub(/\-/, "_").gsub(/\./, "")
                @tag ||= config["tag"] || Git.branch
          Severity: Minor
          Found in lib/dockistrano/service.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 arguments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.arguments(options)
                options.collect do |k,v|
                  case v
                  when TrueClass
                    "-#{k}"
          Severity: Minor
          Found in lib/dockistrano/docker.rb - About 35 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 update_hipache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def update_hipache(server_up=true)
                if !host.nil? and (redis_url = backing_services["hipache"].ip_address)
                  hipache = Hipache.new("redis://#{redis_url}:6379")
                  host.each do |hostname, port|
                    if server_up
          Severity: Minor
          Found in lib/dockistrano/service.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 load_from_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def load_from_image
                raw_config = Docker.run(backing_service.full_image_name, command: "cat /dockistrano.yml", rm: true)
                if raw_config.empty? or raw_config.include?("No such file or directory")
                  if raw_config.include?("failed to mount")
                    raise HostDirectoriesMissing
          Severity: Minor
          Found in lib/dockistrano/service_dependency.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

          Severity
          Category
          Status
          Source
          Language