Showing 98 of 164 total issues
File rails_admin.rb
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
require Rails.root.join('lib/rails_admin/config/fields/types/localized_string')
require Rails.root.join('lib/rails_admin/config/fields/types/localized_text')
require Rails.root.join('lib/rails_admin/config/fields/types/string_list')
require Rails.root.join('lib/rails_admin/config/fields/types/flags')
require Rails.root.join('lib/rails_admin/config/fields/types/duration')
Method preload_included_fragments
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def preload_included_fragments(resources, records, serializer, options)
return if resources.empty?
res_ids = resources.keys
include_directives = options[:include_directives]
- 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 object_hash
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def object_hash(source, include_directives = {})
obj_hash = {}
if source.is_a?(JSONAPI::CachedResourceFragment)
if source.class.name != 'CategoryRecommendationResource'
- 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 preload_included_fragments
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def preload_included_fragments(resources, records, serializer, options)
return if resources.empty?
res_ids = resources.keys
include_directives = options[:include_directives]
Method apply_selects
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def apply_selects(activities, selects, grouped = false)
return activities if selects.empty?
# We use map+reject(blank) so that we can modify the activities in the
# groups
activities = activities.lazy.map do |act|
- 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 associate_initial_anime!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def associate_initial_anime!
exclude_ids = []
puts 'Associating Anime With Categories From AniDB Dump'
data.each do |unfiltered_anime|
unfiltered_anime = unfiltered_anime.deep_symbolize_keys
- 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(ids)
Anime.where(id: ids).includes(
:media_categories, :genres, streaming_links: [:streamer]
).find_each do |anime|
titles = anime.titles_list
Method create?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create?
return false unless user
return false if user.unregistered?
return false if user.blocked?(record.target_user)
return false if user.has_role?(:banned)
- 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 auto_query
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def auto_query(field, value)
case value
when String, Integer, Float, Date
{ match: { field => value } }
when Range
- 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 auto_query
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def auto_query(field, value)
case value
when String, Integer, Float, Date
{ match: { field => value } }
when Range
- 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 list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def list
return @list if @list
list = feed.activities
list = list.page(id_lt: cursor) if cursor
list = list.per(limit) if limit
- 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 follow_many
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def follow_many(follows, backlog)
return false unless ENV['STREAMLOG_REDIS_URL']
follow_keys = follows.map do |follow|
source = follow[:source].split(':')
target = follow[:target].split(':')
- 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 stats_data
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def stats_data
data = super || default_data
# Generate percentile data
if global_stat
data['percentiles'] = %w[media units time].each_with_object({}) do |key, out|
- 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 apply_scopes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def apply_scopes(filters, opts = {})
context = opts[:context]
if _search_service
# Separate queries from filters
queries = filters.select { |f| @_query_fields.include?(f) }
- 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 apply_scopes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def apply_scopes(filters, opts = {})
context = opts[:context]
if @_search_service
# Separate queries from filters
queries = filters.select { |f| @_query_fields.include?(f) }
- 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 create?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create?
return false unless user
return false if user.unregistered?
return false if user.blocked?(record.post.user)
return false if user.has_role?(:banned)
- 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 object_hash
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def object_hash(source, include_directives = {})
obj_hash = {}
if source.is_a?(JSONAPI::CachedResourceFragment)
if source.class.name != 'CategoryRecommendationResource'
Method query_for
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.query_for(query)
fields = %w[name^2 people media]
{
bool: {
must: {
Method create?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create?
return false unless user
return false if user.unregistered?
return false if user.blocked?(record.comment.user)
return false if user.blocked?(record.comment.post.user)
- 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 strip_unenriched
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def strip_unenriched(activities, includes)
activities.map do |act|
if act['activities'] # Recurse into activity groups
act['activities'] = strip_unenriched(act['activities'], includes)
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"