Showing 132 of 331 total issues
Method data
has 806 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data(api_version)
@data ||= Hash.new do |hash, key|
case key
when "debian-cloud"
hash[key] =
File mock.rb
has 835 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Compute
class Google
class Mock
include Fog::Google::Shared
File server.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "fog/compute/models/server"
module Fog
module Compute
class Google
Method get_object
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def get_object(bucket_name, object_name, options = {})
raise ArgumentError.new("bucket_name is required") unless bucket_name
raise ArgumentError.new("object_name is required") unless object_name
response = Excon::Response.new
if (bucket = data[:buckets][bucket_name]) && (object = bucket[:objects][object_name])
- 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 Server
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Compute::Server
identity :name
# @return [Boolean]
attribute :can_ip_forward, :aliases => "canIpForward"
Method test
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test
# Config
name = "fog-lb-test-#{Time.now.to_i}"
zone = "europe-west1-d"
region = "europe-west1"
Method end_element
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
case name
when "DeleteMarker"
@response["Versions"] << { "DeleteMarker" => @delete_marker }
@delete_marker = { "Owner" => {} }
- 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 Instance
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Instance < Fog::Model
identity :name
attribute :current_disk_size, :aliases => "currentDiskSize"
attribute :database_version, :aliases => "databaseVersion"
Method test
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test
connection = Fog::Compute.new(:provider => "google")
health = connection.http_health_checks.create(:name => "test-checks")
instance1 = connection.servers.get("fog-l7-instance-1")
instance2 = connection.servers.get("fog-l7-instance-2")
Method example
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def example
p "Connecting to Google API"
connection = Fog::Compute.new(:provider => "Google")
p "Creating disk"
Method acls
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.acls(type)
case type
when "private"
{
"AccessControlList" => [
Method get
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get(identity, project = nil)
if project
begin
image = service.get_image(identity, project).to_h
# TODO: Remove response modification - see #405
- 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 end_element
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when "DeleteMarker"
@response["Versions"] << { "DeleteMarker" => @delete_marker }
@delete_marker = { "Owner" => {} }
File google.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Compute
class Google < Fog::Service
autoload :Mock, File.expand_path("../google/mock", __FILE__)
autoload :Real, File.expand_path("../google/real", __FILE__)
Method example
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def example
p "Connecting to Google API"
connection = Fog::Compute.new(:provider => "Google")
p "Creating disk"
Method get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get(identity, zone = nil)
if zone
disk = service.get_disk(identity, zone).to_h
# Force the hash to contain a :users key so that it will override any :users key in the existing object
- 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_bucket
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_bucket(bucket_name, options = {})
raise ArgumentError.new("bucket_name is required") unless bucket_name
response = Excon::Response.new
name = /(\w+\.?)*/.match(bucket_name)
if bucket_name == name.to_s
- 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 example
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def example
p "Connecting to Google API"
connection = Fog::Compute.new(:provider => "Google")
p "Creating disk"
- 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 put_object
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def put_object(bucket_name, object_name, data, options = {})
acl = options["x-goog-acl"] || "private"
if !Utils::VALID_ACLS.include?(acl)
raise Excon::Errors::BadRequest.new("invalid x-goog-acl")
else
- 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_bucket
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_bucket(bucket_name, options = {})
raise ArgumentError.new("bucket_name is required") unless bucket_name
response = Excon::Response.new
name = /(\w+\.?)*/.match(bucket_name)
if bucket_name == name.to_s