Showing 20 of 48 total issues
Method index
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def index
if params.include?('user.role') && @user&.dig('role').eql?('ADMIN')
usersIdsByRole = UserService.usersByRole(params['user.role'], request.headers['x-api-key'])
if (params.include?('user'))
params['user'].concat usersIdsByRole if params['user'].kind_of?(Array)
- 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 get_order
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.get_order(options = {})
sort_string = ''
if options['sort']
process_sort_string(options['sort']).split(',').each do |sort|
field_name = sort[0] == '-' ? sort[1..-1] : sort
- 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 fetch_all
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_all(options = {})
dashboards = Dashboard.all
# Deprecated: Please use the same filter options without nesting them in the `filter` param
if options[:filter]
- 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 index
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if params.include?('user.role') && @user&.dig('role').eql?('ADMIN')
usersIdsByRole = UserService.usersByRole(params['user.role'], request.headers['x-api-key'])
if (params.include?('user'))
params['user'].concat usersIdsByRole if params['user'].kind_of?(Array)
Method log_request_to_cloud_watch
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def log_request_to_cloud_watch(validation_response, request)
logger.debug 'Logging request to CloudWatch'
log_query = request.query_parameters.except(:loggedUser)
Method validate_request
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_request(request)
logger.debug 'Validating request'
if request.headers['Authorization'].nil?
logger.debug 'No authorization header found'
Method get_order
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_order(options = {})
field = 'created_at'
direction = 'ASC'
if options['sort']
f = options['sort'].split(',').first
- 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 fetch_all
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_all(options = {})
topics = Topic.all
if options[:filter]
topics = topics.by_published(options[:filter][:published]) if options[:filter][:published]
topics = topics.by_private(options[:filter][:private]) if options[:filter][:private]
- 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 validate_request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_request(request)
logger.debug 'Validating request'
if request.headers['Authorization'].nil?
logger.debug 'No authorization header found'
- 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 get_order
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_order(options = {})
field = 'created_at'
direction = 'ASC'
if options['sort']
f = options['sort'].split(',').first
- 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 get_order
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_order(options = {})
field = 'created_at'
direction = 'ASC'
if options['sort']
f = options['sort'].split(',').first
- 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 get_order
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_order(options = {})
field = 'created_at'
direction = 'ASC'
if options['sort']
f = options['sort'].split(',').first
- 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 manage_content
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def manage_content(base_url)
content_images.each(&:destroy)
begin
contents = JSON.parse(content)
- 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 manage_content
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def manage_content(base_url)
content_images.each(&:destroy)
begin
contents = JSON.parse(content)
- 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 validate_user_and_application
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_user_and_application
validation_response = validate_request(request)
logger.debug 'validation response: ' + validation_response.to_json
return false unless validation_response
- 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 ordering_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ordering_params(params)
ordering = {}
if params[:sort]
sort_order = { '-' => :asc, '+' => :desc }
- 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 log_request_to_cloud_watch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def log_request_to_cloud_watch(validation_response, request)
logger.debug 'Logging request to CloudWatch'
log_query = request.query_parameters.except(:loggedUser)
- 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 assign_content_image_url
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assign_content_image_url(contents, content, _base_url, is_grid = false, grid = nil)
Method assign_content_image_url
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assign_content_image_url(contents, content, _base_url, is_grid = false, grid = nil)
Method fetch_all
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_all(options = {})
partners = Partner.all
if options[:filter]
partners = partners.by_published(options[:filter][:published]) if options[:filter][:published]
partners = partners.by_featured(options[:filter][:featured]) if options[:filter][:featured]
- 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"