Method set_downloaded_source_file
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def set_downloaded_source_file(available_quota_in_bytes=nil)
@checksum = @item_metadata[:checksum]
return self unless modified?
stream_to_file = @datasource.kind_of? CartoDB::Datasources::BaseFileStream
- 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 set_downloaded_source_file
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_downloaded_source_file(available_quota_in_bytes=nil)
@checksum = @item_metadata[:checksum]
return self unless modified?
stream_to_file = @datasource.kind_of? CartoDB::Datasources::BaseFileStream
Method modified?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def modified?
previous_checksum = @options.fetch(:checksum, false)
previous_checksum = false if previous_checksum == '' # If comes empty from DB, make pure false
checksum = (@checksum.nil? || @checksum.size == 0) ? false : @checksum
- 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(datasource, item_metadata, options = {}, logger = nil, repository = nil)
Method store_retrieved_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def store_retrieved_data(filename, resource_data, available_quota_in_bytes)
if resource_data.is_a?(StringIO)
return if resource_data.size.zero?
data = resource_data
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"