Method log?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def log?(application_name_or_id, log_id)
app_guid = app_guid(application_name_or_id)
# test file existence
log_id = 'staging_task.log' if log_id.to_sym == Enums::ApplicationLogfileType::BUILD
# checks also if application is even valid
- 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 recent_log_messages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recent_log_messages(app_guid, filter = nil)
loggregator_recent_uri = "https://#{loggregator_endpoint}:443/recent?app=#{app_guid}"
# current log state before tailing, multipart message of protobuf objects
current_log_response = get(loggregator_recent_uri)
current_log_boundary = /boundary=(\w+)/.match(current_log_response.headers['Content-Type'])[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 push_file_tail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def push_file_tail(app_guid, log_id, stream, pushed_line_idx, headers_to_use)
Method download_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def download_file(app_guid, file_path, headers_to_use = nil)
expected_statuses = [200, 302, 400, 404]
# Hack, do not create fresh headers (which would fail) when in a deferred action
headers_to_use ||= headers
- 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 push_file_tail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def push_file_tail(app_guid, log_id, stream, pushed_line_idx, headers_to_use)
log.debug('Fetching file for tail response...')
entries = download_logfile_entries(app_guid, log_id, headers_to_use)
# file was shortened, close stream since we do not know where to continue
if entries.length < pushed_line_idx
- 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 tail_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def tail_file(app_guid, log_id, stream)
log.debug 'Tailing CF log file'
log_id = 'staging_task.log' if log_id.to_sym == Enums::ApplicationLogfileType::BUILD
# cache headers as they are bound to a request and could be lost with the next tick
- 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"