Showing 18 of 65 total issues
Method list_flavors
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_flavors(filters = {})
response = Excon::Response.new
response.status = 200
response.body = {
Class Server
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Server < Fog::Compute::Server
identity :id
attribute :name
attribute :memory
attribute :vcpus
Method list_regions
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_regions(filters = {})
response = Excon::Response.new
response.status = 200
response.body = {
'regions' => [
Method get_server_details
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_server_details(_)
response = Excon::Response.new
response.status = 200
response.body = {
Method list_volume_actions
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_volume_actions(id)
response = Excon::Response.new
response.status = 201
response.body = {
"actions" => [
Method list_volumes
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_volumes(filters = {})
response = Excon::Response.new
response.status = 200
response.body = {
"volumes" => [
Method detach_volume_by_name
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def detach_volume_by_name(volume_name, droplet_id, region)
response = Excon::Response.new
response.status = 201
response.body = {
"action" => {
Method attach_volume
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attach_volume(volume_id, droplet_id, region)
response = Excon::Response.new
response.status = 201
response.body = {
"action" => {
Method create_server
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_server(name,
size,
image,
region,
options = {})
Method resize_volume
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def resize_volume(volume_id, size, region)
response = Excon::Response.new
response.status = 201
response.body = {
"action" => {
Method attach_volume_by_name
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attach_volume_by_name(volume_name, droplet_id, region)
response = Excon::Response.new
response.status = 201
response.body = {
"action" => {
Method detach_volume
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def detach_volume(volume_id, droplet_id, region)
response = Excon::Response.new
response.status = 201
response.body = {
"action" => {
Method get_volume_details
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_volume_details(_)
response = Excon::Response.new
response.status = 200
response.body = {
Method list_images
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_images(filters = {})
next_page = (filters[:page] || 1).to_i + 1
response = Excon::Response.new
response.status = 200
Method create_server
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_server(name,
size,
image,
region,
options = {})
Method create_server
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_server(name,
size,
image,
region,
options = {})
Method request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def request(params)
params[:headers] ||= {}
begin
response = @connection.request(params)
rescue Excon::Errors::HTTPStatusError => error
- 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 request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def request(params, parse_json = true)
first_attempt = true
begin
response = @connection.request(request_params(params))
rescue Excon::Errors::Unauthorized => error
- 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"