Showing 156 of 616 total issues
Method request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def request(params, parse_json = true)
retried = false
begin
authenticate! if @expires && (@expires - Time.now.utc).to_i < 60
- 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 list_cluster_templates
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_cluster_templates
response = Excon::Response.new
response.status = 200
response.body = {
"clustertemplates" => [
Method get_plan
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_plan(_parameters = nil)
response = Excon::Response.new
response.status = [200, 204][rand(2)]
response.body = {
"created_at" => "2014-09-26T20:23:14.222815",
Method extract_version_from_body
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_version_from_body(body, supported_versions)
versions = []
unless body['versions'].nil? || body['versions'].empty?
versions = body['versions'].kind_of?(Array) ? body['versions'] : body['versions']['values']
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 delete_server
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def delete_server(server_id)
response = Excon::Response.new
server = list_servers_detail.body['servers'].find { |srv| srv['id'] == server_id }
if server
if server['status'] == 'BUILD'
- 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 list_resources
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list_resources(options = {}, options_deprecated = {})
if options.kind_of?(Hash)
if !options.key?(:stack) && !(options.key?(:stack_name) && options.key?(:stack_id))
raise(ArgumentError, "Missing required options keys: :stack or :stack_name and :stack_id, while calling "\
" .list_resources(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 list_bays
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_bays
response = Excon::Response.new
response.status = 200
response.body = {
"bays" => [
Method create_security_group
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_security_group(options = {})
# Spaces are NOT removed from name and description, as in case of compute sec groups
tenant_id = Fog::Mock.random_numbers(14).to_s
sec_group_id = Fog::UUID.uuid
Method update_cluster_template
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_cluster_template(_uuid_or_name, _params)
response = Excon::Response.new
response.status = 200
response.body = {
"insecure_registry" => nil,
Method create_cluster_template
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_cluster_template(_params)
response = Excon::Response.new
response.status = 201
response.body = {
"insecure_registry" => nil,
Method create_bay_model
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_bay_model(_params)
response = Excon::Response.new
response.status = 201
response.body = {
"insecure_registry" => nil,
Method setup
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup(options)
if options.respond_to?(:config_service?) && options.config_service?
configure(options)
return
end
Method get_bay_model
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_bay_model(_uuid_or_name)
response = Excon::Response.new
response.status = 200
response.body = {
"insecure_registry" => nil,
Method update_bay_model
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_bay_model(_uuid_or_name, _params)
response = Excon::Response.new
response.status = 200
response.body = {
"insecure_registry" => nil,
Method get_cluster_template
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_cluster_template(_uuid_or_name)
response = Excon::Response.new
response.status = 200
response.body = {
"insecure_registry" => nil,
Method create_stack
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_stack(arg1, arg2 = nil)
if arg1.kind_of?(Hash)
# Normal use: create_stack(options)
options = arg1
else
Method create_router
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_router(name, options = {})
data = {
'router' => {
'name' => name,
}
Method create_flavor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_flavor(attributes)
response = Excon::Response.new
response.status = 200
response.headers = {
"X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf",
Method create_image
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_image(attributes)
data = {
'Content-Type' => 'application/octet-stream',
'x-image-meta-name' => attributes[:name],
'x-image-meta-disk-format' => attributes[:disk_format],
Method save
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def save(options = {})
requires :directory, :key
options['Cache-Control'] = cache_control if cache_control
options['Content-Type'] = content_type if content_type
options['Content-Disposition'] = content_disposition if content_disposition
- 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"