Showing 96 of 102 total issues
Method map_domain
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def map_domain
domain = client.domain_by_name(input[:name])
given_org = input.has?(:organization)
given_space = input.has?(:space)
- 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
Consider simplifying this complex logical expression. Open
if svc[:label] == "user-provided"
invoke :create_service,
name: name,
offering: CF::Service::UPDummy.new,
app: app,
Method delete
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def delete
apps = client.apps
if input[:all]
return unless input[:really, "ALL APPS", :bad]
- 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 handler
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def handler(event, state)
ans = state.answer
exit if event == :eof
- 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_connection_info
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_connection_info(token)
response = nil
10.times do
begin
response =
Method setup_services
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_services(app, info)
return if !info[:services] || info[:services].empty?
offerings = client.services
Method space
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def space
space = CF::Populators::Space.new(input, org).populate_and_save!
unless space
return if quiet?
Method create_manifest_for
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_manifest_for(app, path)
meta = {
"name" => app.name,
"memory" => human_size(app.memory * 1024 * 1024, 0),
"instances" => app.total_instances,
Method delete_service
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def delete_service
if input[:all]
return unless input[:really, "ALL SERVICES", :bad]
client.service_instances.each do |i|
- 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 locate_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def locate_file(file, directory, search_paths)
search_paths.each do |path|
expanded_path = File.expand_path(path)
next unless File.exists?(expanded_path)
Find.find(expanded_path) do |current|
- 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 target
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def target
unless input.has?(:url) || input.has?(:organization) || input.has?(:space)
TargetPrettifier.prettify(client, self)
return
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 display_app
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def display_app(a)
status = app_status(a)
line "#{c(a.name, :name)}: #{status}"
- 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 check_application
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_application(app)
if app.debug == "suspend"
line "Application is in suspended debugging mode."
line "It will wait for you to attach to it before starting."
return
Method tail
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tail
app = input[:app]
lines = Queue.new
max_len = 0
Method apps
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apps
if space = input[:space]
begin
space.summarize!
rescue CFoundry::APIError
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 stats
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stats
app = input[:app]
stats =
with_progress("Getting stats for #{c(app.name, :name)}") do |s|
begin
Method load_all
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.load_all
# auto-load gems with 'cf-plugin' in their name
matching =
if Gem::Specification.respond_to? :find_all
Gem::Specification.find_all do |s|
Method create_space
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_space
space = client.space
space.organization = org
space.name = input[:name]
Method login
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def login(auth = get_credentials)
if !auth["username"] || !auth["password"]
raise "Unable to verify console credentials."
end