Class CLI
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class CLI < Mothership
include CF::Interactive
include CF::Spacing
option :help, :desc => "Show command usage", :alias => "-h",
File cli.rb
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yaml"
require "socket"
require "net/http"
require "json/ext"
require "multi_json"
Method client
has a Cognitive Complexity of 16 (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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wrap_errors
yield
rescue CFoundry::Timeout => e
err(e.message)
rescue Interrupt
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 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"
Further reading
Method help
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def help
if name = input[:command]
if cmd = @@commands[name.gsub("-", "_").to_sym]
Mothership::Help.command_help(cmd)
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"