engineyard/engineyard

View on GitHub

Showing 24 of 28 total issues

File cli.rb has 707 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'engineyard'
require 'engineyard/error'
require 'engineyard/thor'
require 'engineyard/deploy_config'
require 'engineyard/serverside_runner'
Severity: Major
Found in lib/engineyard/cli.rb - About 1 day to fix

    Method ssh has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def ssh(cmd=nil)
          environment = fetch_environment(options[:environment], options[:account])
          instances = filter_servers(environment, options, default: {app_master: true})
          user = environment.username
          ssh_opts = []
    Severity: Minor
    Found in lib/engineyard/cli.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

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

        class UI < Thor::Base.shell
    
          class Tee
            def initialize(*ios)
              @ios = ios
    Severity: Minor
    Found in lib/engineyard/cli/ui.rb - About 2 hrs to fix

      Method deploy has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def deploy
            app_env = fetch_app_environment(options[:app], options[:environment], options[:account])
      
            env_config    = config.environment_config(app_env.environment_name)
            deploy_config = EY::DeployConfig.new(options, env_config, repo, ui)
      Severity: Major
      Found in lib/engineyard/cli.rb - About 2 hrs to fix

        Method ask has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.ask(question, password = false, default = nil)
                  if @mock
                    @questions ||= []
                    @questions << question
                    answer = @answers.shift
        Severity: Minor
        Found in lib/engineyard/cli/ui.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 agree has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.agree(question, default)
                  if @mock
                    @questions ||= []
                    @questions << question
                    answer = @answers.shift
        Severity: Minor
        Found in lib/engineyard/cli/ui.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 print_envs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def print_envs(apps, default_env_name = nil)
                apps.sort_by {|app| "#{app.account.name}/#{app.name}" }.each do |app|
                  puts "#{app.account.name}/#{app.name}"
                  if app.environments.any?
                    app.environments.sort_by {|env| env.name }.each do |env|
        Severity: Minor
        Found in lib/engineyard/cli/ui.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 filter_servers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def filter_servers(environment, cli_opts, filter_opts)
                if (cli_opts.keys.map(&:to_sym) & OPT_TO_ROLES.keys).any?
                  options = cli_opts.dup
                else
                  options = filter_opts[:default].dup
        Severity: Minor
        Found in lib/engineyard/cli.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 ssh has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def ssh(cmd=nil)
              environment = fetch_environment(options[:environment], options[:account])
              instances = filter_servers(environment, options, default: {app_master: true})
              user = environment.username
              ssh_opts = []
        Severity: Minor
        Found in lib/engineyard/cli.rb - About 1 hr to fix

          Method run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def run(remote_command, out, err)
                cmd = Escape.shell_command(['bash', '-lc', remote_command])
          
                if cmd.respond_to?(:encoding) && cmd.respond_to?(:force_encoding)
                  out << "Encoding: #{cmd.encoding.name}" if @verbose
          Severity: Minor
          Found in lib/engineyard/serverside_runner.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 environments has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def environments
                if options[:all] && options[:simple]
                  ui.print_simple_envs api.environments
                elsif options[:all]
                  ui.print_envs api.apps
          Severity: Minor
          Found in lib/engineyard/cli.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 help has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def help(*cmds)
                if cmds.empty?
                  base = self.class.send(:banner_base)
                  list = self.class.printable_tasks
          
          
          Severity: Minor
          Found in lib/engineyard/cli.rb - About 1 hr to fix

            Method environments has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def environments
                  if options[:all] && options[:simple]
                    ui.print_simple_envs api.environments
                  elsif options[:all]
                    ui.print_envs api.apps
            Severity: Minor
            Found in lib/engineyard/cli.rb - About 1 hr to fix

              Method ssh has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def ssh(cmd, hostname, username, out, err)
                    exit_code = 1
                    Net::SSH.start(hostname, username, net_ssh_options) do |net_ssh|
                      net_ssh.open_channel do |channel|
                        channel.exec cmd do |_, success|
              Severity: Minor
              Found in lib/engineyard/serverside_runner.rb - About 1 hr to fix

                Method deploy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def deploy
                      app_env = fetch_app_environment(options[:app], options[:environment], options[:account])
                
                      env_config    = config.environment_config(app_env.environment_name)
                      deploy_config = EY::DeployConfig.new(options, env_config, repo, ui)
                Severity: Minor
                Found in lib/engineyard/cli.rb - About 55 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 scp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def scp(from_path, to_path)
                      environment = fetch_environment(options[:environment], options[:account])
                      instances   = filter_servers(environment, options, default: {app_master: true})
                      user        = environment.username
                
                
                Severity: Minor
                Found in lib/engineyard/cli.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 cookbooks_dir_archive_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def cookbooks_dir_archive_path
                          unless FileTest.exist?("cookbooks")
                            raise EY::Error, "Could not find chef recipes. Please run from the root of your recipes repo."
                          end
                
                
                Severity: Minor
                Found in lib/engineyard/cli/recipes.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 debug has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def debug(name, message = nil)
                        if ENV["DEBUG"]
                          name    = name.inspect    unless name.nil? or name.is_a?(String)
                          message = message.inspect unless message.nil? or message.is_a?(String)
                          say_with_status(name, message, :blue)
                Severity: Minor
                Found in lib/engineyard/cli/ui.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 ssh has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def ssh(cmd, hostname, username, out, err)
                Severity: Minor
                Found in lib/engineyard/serverside_runner.rb - About 35 mins to fix

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

                      def load_adapter(bridge, app, environment, verbose, serverside_version)
                  Severity: Minor
                  Found in lib/engineyard/serverside_runner.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language