Showing 62 of 87 total issues
File command_executor.rb
has 504 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'openssl'
require 'fileutils'
require 'aws-sdk-core'
require 'aws-sdk-s3'
require 'zlib'
Method initialize
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def initialize(data)
raise 'Deployment Spec has no DeploymentId' unless property_set?(data, "DeploymentId")
raise 'Deployment Spec has no DeploymentGroupId' unless property_set?(data, "DeploymentGroupId")
raise 'Deployment Spec has no DeploymentGroupName' unless property_set?(data, "DeploymentGroupName")
raise 'Deployment Spec has no ApplicationName' unless property_set?(data, "ApplicationName")
- Read upRead up
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 36 (exceeds 5 allowed). Consider refactoring. Open
def initialize(ace, internal=false)
@default = false
@type = nil
@name = ""
parts = ace.split(":", -1).reverse
- Read upRead up
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 CommandExecutor
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class CommandExecutor
class << self
attr_reader :command_methods
end
File install_instruction.rb
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'etc'
require 'fileutils'
require 'json'
module InstanceAgent
Method initialize
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(ace, internal=false)
@default = false
@type = nil
@name = ""
parts = ace.split(":", -1).reverse
File hook_executor.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'timeout'
require 'open3'
require 'json'
require 'fileutils'
Method configure
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.configure
file_path = InstanceAgent::Config.config[:on_premises_config_file]
file_config = nil
if File.exists?(file_path) && File.readable?(file_path)
begin
- Read upRead up
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 validate
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate(args)
location = args['--bundle-location']
type = args['--type']
unless VALID_TYPES.include? type
- Read upRead up
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 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(data)
raise 'Deployment Spec has no DeploymentId' unless property_set?(data, "DeploymentId")
raise 'Deployment Spec has no DeploymentGroupId' unless property_set?(data, "DeploymentGroupId")
raise 'Deployment Spec has no DeploymentGroupName' unless property_set?(data, "DeploymentGroupName")
raise 'Deployment Spec has no ApplicationName' unless property_set?(data, "ApplicationName")
Method generate_instructions
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def generate_instructions(application_specification)
InstanceAgent::Plugins::CodeDeployPlugin::InstallInstruction.generate_instructions() do |i|
application_specification.files.each do |fi|
absolute_source_path = File.join(deployment_archive_dir, fi.source)
file_exists_behavior = application_specification.respond_to?(:file_exists_behavior) && application_specification.file_exists_behavior ? application_specification.file_exists_behavior : @file_exists_behavior
- Read upRead up
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 download_from_s3
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def download_from_s3(deployment_spec, bucket, key, version, etag)
log(:info, "Downloading artifact bundle from bucket '#{bucket}' and key '#{key}', version '#{version}', etag '#{etag}'")
options = s3_options()
s3 = Aws::S3::Client.new(options)
- Read upRead up
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 execute
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def execute
return if @app_spec.nil?
if (hooks = @app_spec.hooks[@lifecycle_event]) &&
!hooks.empty?
create_script_log_file_if_needed do |script_log_file|
- Read upRead up
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 download_from_github
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def download_from_github(deployment_spec, account, repo, commit, anonymous, token)
retries = 0
errors = []
- Read upRead up
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 download_from_github
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download_from_github(deployment_spec, account, repo, commit, anonymous, token)
retries = 0
errors = []
Method parse_hooks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_hooks(hooks_hash)
temp_hooks_hash = Hash.new
hooks_hash.each_pair do |hook, scripts|
# Ignore empty hooks.
if scripts
- Read upRead up
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 get_range
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_range
range = "s" + @low_sensitivity.to_s
if (@low_sensitivity != @high_sensitivity)
range = range + "-s" + @high_sensitivity.to_s
end
- Read upRead up
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 stop
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def stop
if (pid = self.class.find_pid)
puts "Checking first if a deployment is already in progress"
ProcessManager::Log.info("Checking first if any deployment lifecycle event is in progress #{description(pid)}")
begin
- Read upRead up
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 unpack_bundle
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unpack_bundle(cmd, bundle_file, deployment_spec)
dst = File.join(deployment_root_dir(deployment_spec), 'deployment-archive')
if "tar".eql? deployment_spec.bundle_type
InstanceAgent::Platform.util.extract_tar(bundle_file, dst)
Method validate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(args)
location = args['--bundle-location']
type = args['--type']
unless VALID_TYPES.include? type