app/helpers/file_upload.rb
Method upload_file_to_storage
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
def upload_file_to_storage(filename_param: nil,
file_param: nil,
request_body: nil,
s3_config: nil,
timestamp: Time.now,
- 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_file_to_storage
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def upload_file_to_storage(filename_param: nil,
file_param: nil,
request_body: nil,
s3_config: nil,
timestamp: Time.now,
Method filedata_from_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def filedata_from_params(filename_param, file_param, request_body, random_token, filename)
Method filedata_from_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def filedata_from_params(filename_param, file_param, request_body, random_token, filename)
case
when filename_param.present? && request_body.present?
filedata = filename_param
when file_param.present?
- 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"