Showing 46 of 46 total issues
Method upload_app
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def upload_app(guid, zipfile = nil, resources = [])
payload = {}
payload[:resources] = MultiJson.dump(resources)
if zipfile
- 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 has_summary
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_summary(actions = {})
#
# def summary
#
define_method(:summary) do
Method log_request
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def log_request(time, request, response)
return unless @log
data = log_data(time, request, response)
Method succeed_to_load
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def succeed_to_load(options={})
response_body = Helper.load_fixtures(options[:fixture] || "fake_cc_user")
response_body["metadata"]["guid"] = options[:id] || "user-id-1"
if options[:no_organizations]
Method value_matches?
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def value_matches?(val, type)
return true if val.nil?
case type
when Class
Method filter_protected_attributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_protected_attributes(hash_or_array)
if hash_or_array.is_a? Array
hash_or_array.each do |value|
filter_protected_attributes(value)
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 proxy_options_for
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def proxy_options_for(uri)
ssl = uri.is_a?(URI::HTTPS)
proxy_to_use = (ssl ? https_proxy : http_proxy)
if proxy_to_use.blank?
- 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 token_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def token_data
return @token_data if @token_data
return {} unless @auth_header
json_hashes = Base64.decode64(@auth_header.split(" ", 2).last)
- 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 value_matches?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def value_matches?(val, type)
return true if val.nil?
case type
when Class
- 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 params_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.params_from(args)
options, _ = args
options ||= {}
options[:depth] ||= 1
- 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 find_archives_in_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_archives_in_path(path)
files = Array.new
list = Array.new
if File.file?(path)
files << path
- 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 percent_running
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def percent_running
if state == "STARTED"
healthy_count = running_instances
expected = total_instances
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(app_name, app_guid, id, client, manifest = {})
Method generate_headers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_headers(payload, options)
headers = {}
if payload.is_a?(String)
headers["Content-Length"] = payload.size
- 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 upload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def upload(path, check_resources = true)
unless File.exist? path
raise CFoundry::Error, "Invalid application path '#{path}'"
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 has_summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def has_summary(actions = {})
#
# def summary
#
define_method(:summary) do
- 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
Avoid too many return
statements within this method. Open
return
Method unpack
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unpack(file, dest)
::Zip::ZipFile.foreach(file) do |zentry|
epath = "#{dest}/#{zentry}"
dirname = File.dirname(epath)
FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
- 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 print_backtrace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def print_backtrace(locs)
return unless @backtrace
interesting_locs = locs.drop_while { |loc|
loc =~ /\/(cfoundry\/|restclient\/|net\/http)/
- 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 stream_update_log
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stream_update_log(log_url)
offset = 0
while true
begin
- 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"