Method fields_per_model
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def fields_per_model(params_fields, model)
if params_fields
if Rails::VERSION::MAJOR > 4
params_fields_hash = params_fields.to_unsafe_h
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"
Further reading
Method render_csv
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def render_csv getter, model
set_headers_file
set_headers_streaming
response.status = 200
- 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 render_csv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_csv getter, model
set_headers_file
set_headers_streaming
response.status = 200
Method authenticate_user_from_jwt
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_user_from_jwt
begin
if request.headers
if request.headers['Authorization']
token = request.headers['Authorization'].split.second
- 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 fields_per_model
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fields_per_model(params_fields, model)
if params_fields
if Rails::VERSION::MAJOR > 4
params_fields_hash = params_fields.to_unsafe_h
else
Method force_utf8_attributes_encoding
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def force_utf8_attributes_encoding(model)
# NOTICE: Declare all strings are encoded in utf-8
if model['attributes']
model['attributes'].each do |name, value|
if value.respond_to?(:force_encoding)
- 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"