Class CLI
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class CLI < Mothership
include VMC::Interactive
include VMC::Spacing
option :help, :desc => "Show command usage", :alias => "-h",
File cli.rb
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yaml"
require "socket"
require "net/http"
require "multi_json"
require "fileutils"
Method client
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def client(target = client_target)
return @@client if defined?(@@client) && @@client
return unless target
info = target_info(target)
- 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 wrap_errors
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wrap_errors
yield
rescue CFoundry::Timeout => e
err(e.message)
rescue Interrupt
Method client
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def client(target = client_target)
return @@client if defined?(@@client) && @@client
return unless target
info = target_info(target)
Method log_error
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def log_error(e)
ensure_config_dir
msg = e.class.name
msg << ": #{e}" unless e.to_s.empty?
Method log_error
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def log_error(e)
ensure_config_dir
msg = e.class.name
msg << ": #{e}" unless e.to_s.empty?
- 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 wrap_errors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def wrap_errors
yield
rescue CFoundry::Timeout => e
err(e.message)
rescue Interrupt
- 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 precondition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def precondition
check_target
check_logged_in
return unless v2?
- 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 save_token_if_it_changes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_token_if_it_changes
return yield unless client && client.token
before_token = client.token
- 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"